mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-22 00:41:28 +00:00
fixes #18081; fixes https://github.com/nim-lang/Nim/issues/18080 fixes #18079 reverts https://github.com/nim-lang/Nim/pull/20738 It is probably more reasonable to use the type node from `nkObjConstr` since it is barely changed unlike the external type, which is susceptible to code transformation e.g. `addr(deref objconstr)`.
This commit is contained in:
@@ -31,3 +31,39 @@ elif defined(gcRefc):
|
||||
doAssert x.repr == "[p = nil]"
|
||||
else: # fixme # bug #20081
|
||||
doAssert x.repr == "Pledge(p: nil)"
|
||||
|
||||
block:
|
||||
block: # bug #18081
|
||||
type
|
||||
Foo = object
|
||||
discard
|
||||
|
||||
Bar = object
|
||||
x: Foo
|
||||
|
||||
proc baz(state: var Bar) =
|
||||
state.x = Foo()
|
||||
|
||||
baz((ref Bar)(x: (new Foo)[])[])
|
||||
|
||||
block: # bug #18079
|
||||
type
|
||||
Foo = object
|
||||
discard
|
||||
|
||||
Bar = object
|
||||
x: Foo
|
||||
|
||||
proc baz(state: var Bar) = discard
|
||||
baz((ref Bar)(x: (new Foo)[])[])
|
||||
|
||||
block: # bug #18080
|
||||
type
|
||||
Foo = object
|
||||
discard
|
||||
|
||||
Bar = object
|
||||
x: Foo
|
||||
|
||||
proc baz(state: var Bar) = discard
|
||||
baz((ref Bar)(x: Foo())[])
|
||||
|
||||
Reference in New Issue
Block a user