cleanup index generation
This commit is contained in:
parent
eec18896b7
commit
c2da0e9b3d
8 changed files with 71 additions and 37 deletions
27
tests/objects/trefobjsyntax.nim
Normal file
27
tests/objects/trefobjsyntax.nim
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
discard """
|
||||
output: '''wohoo
|
||||
baz'''
|
||||
"""
|
||||
|
||||
# Test to ensure the popular 'ref T' syntax works everywhere
|
||||
|
||||
type
|
||||
Foo = object
|
||||
a, b: int
|
||||
s: string
|
||||
|
||||
FooBar = object of RootObj
|
||||
n, m: string
|
||||
Baz = object of FooBar
|
||||
|
||||
proc invoke(a: ref Baz) =
|
||||
echo "baz"
|
||||
|
||||
# check object construction:
|
||||
let x = (ref Foo)(a: 0, b: 45, s: "wohoo")
|
||||
echo x.s
|
||||
|
||||
var y: ref FooBar = (ref Baz)(n: "n", m: "m")
|
||||
|
||||
invoke((ref Baz)(y))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue