Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
ringabout
2026-05-01 21:11:22 +08:00
parent 63a04f3420
commit 34ab149b9d
4 changed files with 36 additions and 24 deletions

View File

@@ -13,25 +13,3 @@ type
pendingTasks*: range[0'i32 .. high(int32)]
head: T
tail: T
block:
type
Foo = object
x = Bar()
Bar = object
x: int
var f = Foo()
doassert f.x.x == 0
block:
type
Bar = object
x: int
Foo = object
x = Bar()
var f = Foo()
doassert f.x.x == 0

View File

@@ -833,4 +833,37 @@ proc overloaded[T: object](x: T) =
var v: typeof(val)
overloaded(v)
overloaded(Thing())
overloaded(Thing())
block:
type
Foo = object
x = Bar()
Bar = object
x: int
var f = Foo()
doassert f.x.x == 0
block:
type
Foo = object
x = Bar(x: 55)
Bar = object
x: int
var f = Foo()
doassert f.x.x == 55
block:
type
Bar = object
x: int
Foo = object
x = Bar()
var f = Foo()
doassert f.x.x == 0