diff options
author | Araq <rumpf_a@web.de> | 2014-11-28 02:43:41 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-28 02:43:41 +0100 |
commit | 105a0616a9da7c9c85adfa488a1db42eb17daafb (patch) | |
tree | 06142dcf57ce1fdfc5adcc5d389a3146dd9c228b /tests/method/tmultim2.nim | |
parent | d456b882b16c44d7862682fd5e898868d5171ac5 (diff) | |
download | Nim-105a0616a9da7c9c85adfa488a1db42eb17daafb.tar.gz |
implemented procCall builtin
Diffstat (limited to 'tests/method/tmultim2.nim')
-rw-r--r-- | tests/method/tmultim2.nim | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/method/tmultim2.nim b/tests/method/tmultim2.nim index 75f652137..c5fb568a0 100644 --- a/tests/method/tmultim2.nim +++ b/tests/method/tmultim2.nim @@ -1,6 +1,9 @@ discard """ file: "tmultim2.nim" - output: "collide: unit, thing collide: unit, thing collide: thing, unit" + output: '''collide: unit, thing +collide: unit, thing +collide: thing, unit +collide: thing, thing''' """ # Test multi methods @@ -12,25 +15,25 @@ type a, b: int method collide(a, b: TThing) {.inline.} = - quit "to override!" + echo "collide: thing, thing" method collide(a: TThing, b: TUnit) {.inline.} = - write stdout, "collide: thing, unit " + echo "collide: thing, unit" method collide(a: TUnit, b: TThing) {.inline.} = - write stdout, "collide: unit, thing " + echo "collide: unit, thing" proc test(a, b: TThing) {.inline.} = collide(a, b) +proc staticCollide(a, b: TThing) {.inline.} = + procCall collide(a, b) + + var a: TThing b, c: TUnit collide(b, c) # ambiguous (unit, thing) or (thing, unit)? -> prefer unit, thing! test(b, c) collide(a, b) -#OUT collide: unit, thing collide: unit, thing collide: thing, unit - - - - +staticCollide(a, b) |