diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/overload/importA.nim | 5 | ||||
-rw-r--r-- | tests/overload/importB.nim | 15 | ||||
-rw-r--r-- | tests/overload/timport.nim | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/overload/importA.nim b/tests/overload/importA.nim new file mode 100644 index 000000000..f045d11b4 --- /dev/null +++ b/tests/overload/importA.nim @@ -0,0 +1,5 @@ +type + Field* = object + elemSize*: int + +template `+`*(x: untyped, y: Field): untyped = x diff --git a/tests/overload/importB.nim b/tests/overload/importB.nim new file mode 100644 index 000000000..2dc3adf7a --- /dev/null +++ b/tests/overload/importB.nim @@ -0,0 +1,15 @@ +type + Foo*[T] = object + v*: T + +template `+`*(x: Foo, y: Foo): untyped = x + +template newvar*(r: untyped): untyped {.dirty.} = + var r: float + +template t1*(x: Foo): untyped = + newvar(y1) + x +template t2*(x: Foo): untyped = + newvar(y2) + x diff --git a/tests/overload/timport.nim b/tests/overload/timport.nim new file mode 100644 index 000000000..8ea65e54d --- /dev/null +++ b/tests/overload/timport.nim @@ -0,0 +1,7 @@ +# issue 4675 +import importA # comment this out to make it work +import importB + +var x: Foo[float] +var y: Foo[float] +let r = t1(x) + t2(y) |