mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
19 lines
353 B
Nim
19 lines
353 B
Nim
# 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.}
|