mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
first steps to allow easy functors via macros
This commit is contained in:
19
tests/fields/timplicitfieldswithpartial.nim
Normal file
19
tests/fields/timplicitfieldswithpartial.nim
Normal file
@@ -0,0 +1,19 @@
|
||||
discard """
|
||||
out: '''(foo0: 38, other1: string here)
|
||||
43'''
|
||||
"""
|
||||
|
||||
type
|
||||
Base = ref object of RootObj
|
||||
Foo {.partial.} = ref object of Base
|
||||
|
||||
proc my(f: Foo) =
|
||||
#var f.next = f
|
||||
let f.foo = 38
|
||||
let f.other = "string here"
|
||||
echo f[]
|
||||
echo f.foo0 + 5
|
||||
|
||||
var g: Foo
|
||||
new(g)
|
||||
my(g)
|
||||
Reference in New Issue
Block a user