summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-12-24 17:22:10 +0300
committerGitHub <noreply@github.com>2023-12-24 15:22:10 +0100
commitfc49c6e3ba5081593e4d9af7e04bfb84e97a39f5 (patch)
tree3dc9135f02957e34c4dc14ffcaf27491d48b6c79 /lib
parent6fee2240cd327fbe65548eaed9ca21355a1a24b5 (diff)
downloadNim-fc49c6e3ba5081593e4d9af7e04bfb84e97a39f5.tar.gz
fix spurious indent and newlines in rendering of nkRecList (#23121)
Rendering of `nkRecList` produces an indent and adds a new line at the
end. However for things like case object `of`/`else` branches or `when`
branches this is already done, so this produces 2 indents and an extra
new line. Instead, just add an indent in the place where the indent that
`nkRecList` produces is needed, for the rendering of the final node of
`nkObjectTy`. There doesn't seem to be a need to add the newline.

Before:

```nim
case x*: bool
of true:
    y*: int

of false:
  nil
```

After:

```nim
case x*: bool
of true:
  y*: int
of false:
  nil
```
Diffstat (limited to 'lib')
-rw-r--r--lib/core/macros.nim3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index fe911ffbf..bd1de9cd7 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -347,8 +347,7 @@ proc getTypeImpl*(n: NimNode): NimNode {.magic: "NGetType", noSideEffect.} =
       newLit(x.getTypeImpl.repr)
     let t = """
 object
-  arr: array[0 .. 3, float32]
-"""
+  arr: array[0 .. 3, float32]"""
     doAssert(dumpTypeImpl(a) == t)
     doAssert(dumpTypeImpl(b) == t)
     doAssert(dumpTypeImpl(c) == t)