diff options
Diffstat (limited to 'tests/template/twrongmapit.nim')
-rw-r--r-- | tests/template/twrongmapit.nim | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/template/twrongmapit.nim b/tests/template/twrongmapit.nim index df695fcd6..2d53d03f5 100644 --- a/tests/template/twrongmapit.nim +++ b/tests/template/twrongmapit.nim @@ -1,24 +1,22 @@ discard """ - output: "####" + joinable: false """ -# unfortunately our tester doesn't support multiple lines of compiler -# error messages yet... # bug #1562 type Foo* {.pure, final.} = object elt: float -template defineOpAssign(T: expr, op: expr) {.immediate.} = - proc op*(v: var T, w: T) {.inline.} = +template defineOpAssign(T, op: untyped) = + proc `op`*(v: var T, w: T) {.inline.} = for i in 0..1: - op(v.elt, w.elt) + `op`(v.elt, w.elt) const ATTEMPT = 0 when ATTEMPT == 0: # FAILS: defining `/=` with template calling template # ERROR about sem.nim line 144 - template defineOpAssigns(T: expr) {.immediate.} = + template defineOpAssigns(T: untyped) = mixin `/=` defineOpAssign(T, `/=`) @@ -29,4 +27,4 @@ import sequtils (var i = @[""];i).applyIt(it) # now works: -echo "##", i[0], "##" +doAssert i[0] == "" |