Nim icon indicating copy to clipboard operation
Nim copied to clipboard

nimpretty, whitespace is missing: `or \n defined` -> `ordefined`

Open haoyu234 opened this issue 7 months ago • 0 comments

Nim Version

Nim Compiler Version 2.3.1 [Linux: amd64] Compiled at 2025-04-02 Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f9c8775783c98094615a90760b2ae9a4aca03c70 active boot switches: -d:release

Description

The code is from the standard library, but it has been preprocessed by nph, so it is not exactly the same as the standard library code. https://github.com/nim-lang/Nim/blob/10c9ebad9303d9c4be393da913f4e12650783539/lib/pure/osproc.nim#L1238-L1240

This can be reproduced by using nimpretty to format the following code snippet.

when defined(macosx) or defined(freebsd) or defined(netbsd) or defined(openbsd) or
    defined(dragonfly):
  import std/kqueue

Current Output

when defined(macosx) or defined(freebsd) or defined(netbsd) or defined(
    openbsd) ordefined(dragonfly):
  import std/kqueue

Expected Output

when defined(macosx) or defined(freebsd) or defined(netbsd) or defined(
    openbsd) or defined(dragonfly):
  import std/kqueue

Known Workarounds

No response

Additional Information

No response

haoyu234 avatar Apr 04 '25 05:04 haoyu234