mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 06:43:52 +00:00
make tests green again
This commit is contained in:
@@ -23,16 +23,16 @@ type
|
||||
T2 = object
|
||||
x: int
|
||||
|
||||
proc `.`*(v: T1, f: string): int =
|
||||
echo "reading field ", f
|
||||
return v.x
|
||||
template `.`*(v: T1, f: untyped): int =
|
||||
echo "reading field ", astToStr(f)
|
||||
v.x
|
||||
|
||||
proc `.=`(x: var T1, f: string{lit}, v: int) =
|
||||
echo "assigning ", f, " = ", v
|
||||
x.x = v
|
||||
template `.=`(t: var T1, f: untyped, v: int) =
|
||||
echo "assigning ", astToStr(f), " = ", v
|
||||
t.x = v
|
||||
|
||||
template `.()`(x: T1, f: string, args: varargs[typed]): string =
|
||||
echo "call to ", f
|
||||
template `.()`(x: T1, f: untyped, args: varargs[typed]): string =
|
||||
echo "call to ", astToStr(f)
|
||||
"dot call"
|
||||
|
||||
echo ""
|
||||
@@ -47,13 +47,13 @@ echo t.y()
|
||||
var d = TD(t)
|
||||
assert(not compiles(d.y))
|
||||
|
||||
proc `.`(v: T2, f: string): int =
|
||||
echo "no params call to ", f
|
||||
return v.x
|
||||
template `.`(v: T2, f: untyped): int =
|
||||
echo "no params call to ", astToStr(f)
|
||||
v.x
|
||||
|
||||
proc `.`*(v: T2, f: string, a: int): int =
|
||||
echo "one param call to ", f, " with ", a
|
||||
return v.x
|
||||
template `.`*(v: T2, f: untyped, a: int): int =
|
||||
echo "one param call to ", astToStr(f), " with ", a
|
||||
v.x
|
||||
|
||||
var tt = T2(x: 100)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user