diff options
author | Araq <rumpf_a@web.de> | 2014-11-20 21:02:51 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-20 21:02:51 +0100 |
commit | bb532a697edad1bac60a87a7ff43956c9635973d (patch) | |
tree | ccdf1750dd76c17737096a0a19a46065fbef48e8 /tests/template | |
parent | 3215666e33846db87e3b3ac1b6ab51a14f7b6912 (diff) | |
download | Nim-bb532a697edad1bac60a87a7ff43956c9635973d.tar.gz |
fixes #1562, fixes #1543
Diffstat (limited to 'tests/template')
-rw-r--r-- | tests/template/twrongmapit.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/template/twrongmapit.nim b/tests/template/twrongmapit.nim new file mode 100644 index 000000000..4b3e1553f --- /dev/null +++ b/tests/template/twrongmapit.nim @@ -0,0 +1,32 @@ +discard """ + errormsg: "'" + file: "sequtils.nim" + line: 416 +""" +# 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.} = + for i in 0..1: + 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.} = + mixin `/=` + defineOpAssign(T, `/=`) + + defineOpAssigns(Foo) + +# bug #1543 +import sequtils + +(var i= @[""];i).mapIt(it) |