parent
b62f4b1b0c
commit
fd16875561
4 changed files with 51 additions and 4 deletions
18
tests/overload/tor_isnt_better.nim
Normal file
18
tests/overload/tor_isnt_better.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
discard """
|
||||
errormsg: "ambiguous call;"
|
||||
line: 16
|
||||
"""
|
||||
|
||||
# bug #8568
|
||||
|
||||
type
|
||||
D[T] = object
|
||||
E[T] = object
|
||||
|
||||
proc g(a: D|E): string = "foo D|E"
|
||||
proc g(a: D): string = "foo D"
|
||||
|
||||
proc test() =
|
||||
let x = g D[int]()
|
||||
|
||||
test()
|
||||
|
|
@ -176,6 +176,28 @@ block tstaticoverload:
|
|||
foo("constant" & " " & "folding")
|
||||
foo(staticString("static string"))
|
||||
|
||||
# bug #8568 (2)
|
||||
|
||||
proc goo(a: int): string = "int"
|
||||
proc goo(a: static[int]): string = "static int"
|
||||
proc goo(a: var int): string = "var int"
|
||||
proc goo[T: int](a: T): string = "T: int"
|
||||
#proc goo[T](a: T): string = "nur T"
|
||||
|
||||
const tmp1 = 1
|
||||
let tmp2 = 1
|
||||
var tmp3 = 1
|
||||
|
||||
doAssert goo(1) == "static int"
|
||||
doAssert goo(tmp1) == "static int"
|
||||
doAssert goo(tmp2) == "int"
|
||||
doAssert goo(tmp3) == "var int"
|
||||
|
||||
doAssert goo[int](1) == "T: int"
|
||||
|
||||
doAssert goo[int](tmp1) == "T: int"
|
||||
doAssert goo[int](tmp2) == "T: int"
|
||||
doAssert goo[int](tmp3) == "T: int"
|
||||
|
||||
# bug #6076
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue