make binary not not parse complex expressions on right side (#22078)

* binary `not` only parses simple expressions

fixes #16324

* switch to primary
This commit is contained in:
metagn
2023-06-12 07:22:50 +03:00
committed by GitHub
parent 7b1c448744
commit e0ad71a912
3 changed files with 25 additions and 7 deletions

18
tests/notnil/tparse.nim Normal file
View File

@@ -0,0 +1,18 @@
# issue #16324
{.push experimental: "notnil".}
block:
type Foo = ref object
value: int
proc newFoo1(): Foo not nil = # This compiles
return Foo(value: 1)
proc newFoo2(): Foo not nil {.inline.} = # This does not
return Foo(value: 1)
doAssert newFoo1().value == 1
doAssert newFoo2().value == 1
{.pop.}