mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
Add a test case for issue #4675.
This commit is contained in:
5
tests/overload/importA.nim
Normal file
5
tests/overload/importA.nim
Normal file
@@ -0,0 +1,5 @@
|
||||
type
|
||||
Field* = object
|
||||
elemSize*: int
|
||||
|
||||
template `+`*(x: untyped, y: Field): untyped = x
|
||||
15
tests/overload/importB.nim
Normal file
15
tests/overload/importB.nim
Normal file
@@ -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
|
||||
7
tests/overload/timport.nim
Normal file
7
tests/overload/timport.nim
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user