diff options
author | Matthew Baulch <baulch.matt@gmail.com> | 2016-09-03 21:21:06 +1000 |
---|---|---|
committer | Matthew Baulch <baulch.matt@gmail.com> | 2016-09-03 21:21:06 +1000 |
commit | 9a2b98cd8bb7b4220b1ee959ce2af730f4770cc6 (patch) | |
tree | 534969bbbd2f984e0bab78f0b7873f1eb9c70065 /tests/overload | |
parent | 3fef725d920f87f2f8bf8de80d746c8a8b568055 (diff) | |
download | Nim-9a2b98cd8bb7b4220b1ee959ce2af730f4770cc6.tar.gz |
Add a test case for issue #4675.
Diffstat (limited to 'tests/overload')
-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) |