mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
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:
18
tests/notnil/tparse.nim
Normal file
18
tests/notnil/tparse.nim
Normal 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.}
|
||||
Reference in New Issue
Block a user