twrongmapit.nim 665 B

12345678910111213141516171819202122232425262728293031323334
  1. discard """
  2. disabled: true
  3. output: "####"
  4. """
  5. # unfortunately our tester doesn't support multiple lines of compiler
  6. # error messages yet...
  7. # bug #1562
  8. type Foo* {.pure, final.} = object
  9. elt: float
  10. template defineOpAssign(T, op: untyped) =
  11. proc `op`*(v: var T, w: T) {.inline.} =
  12. for i in 0..1:
  13. `op`(v.elt, w.elt)
  14. const ATTEMPT = 0
  15. when ATTEMPT == 0:
  16. # FAILS: defining `/=` with template calling template
  17. # ERROR about sem.nim line 144
  18. template defineOpAssigns(T: untyped) =
  19. mixin `/=`
  20. defineOpAssign(T, `/=`)
  21. defineOpAssigns(Foo)
  22. # bug #1543
  23. import sequtils
  24. (var i = @[""];i).applyIt(it)
  25. # now works:
  26. echo "##", i[0], "##"