fix #1820
This commit is contained in:
parent
1d5ecc0dea
commit
2f90be13e2
2 changed files with 38 additions and 2 deletions
|
|
@ -989,7 +989,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
||||||
if aOrig.kind == tyStatic:
|
if aOrig.kind == tyStatic:
|
||||||
result = typeRel(c, f.lastSon, a)
|
result = typeRel(c, f.lastSon, a)
|
||||||
if result != isNone and f.n != nil:
|
if result != isNone and f.n != nil:
|
||||||
if not exprStructuralEquivalent(f.n, a.n):
|
if not exprStructuralEquivalent(f.n, aOrig.n):
|
||||||
result = isNone
|
result = isNone
|
||||||
if result != isNone: put(c.bindings, f, aOrig)
|
if result != isNone: put(c.bindings, f, aOrig)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tstaticparams.nim"
|
file: "tstaticparams.nim"
|
||||||
output: "abracadabra\ntest\n3\n15\n4\n2"
|
output: "abracadabra\ntest\n3\n15\n4\n2\nfloat\n3\nfloat\nyin\nyang"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -83,3 +83,39 @@ reject matrix_2(tmat, ar1)
|
||||||
reject matrix_3(tmat, ar2)
|
reject matrix_3(tmat, ar2)
|
||||||
reject matrix_4(tmat, ar1)
|
reject matrix_4(tmat, ar1)
|
||||||
|
|
||||||
|
# bug 1820
|
||||||
|
|
||||||
|
type
|
||||||
|
T1820_1[T; Y: static[int]] = object
|
||||||
|
bar: T
|
||||||
|
|
||||||
|
proc intOrFloat*[Y](f: T1820_1[int, Y]) = echo "int"
|
||||||
|
proc intOrFloat*[Y](f: T1820_1[float, Y]) = echo "float"
|
||||||
|
proc threeOrFour*[T](f: T1820_1[T, 3]) = echo "3"
|
||||||
|
proc threeOrFour*[T](f: T1820_1[T, 4]) = echo "4"
|
||||||
|
|
||||||
|
var foo_1: T1820_1[float, 3]
|
||||||
|
|
||||||
|
foo_1.intOrFloat
|
||||||
|
foo_1.threeOrFour
|
||||||
|
|
||||||
|
type
|
||||||
|
YinAndYang = enum
|
||||||
|
Yin,
|
||||||
|
Yang
|
||||||
|
|
||||||
|
T1820_2[T; Y: static[YinAndYang]] = object
|
||||||
|
bar: T
|
||||||
|
|
||||||
|
proc intOrFloat*[Y](f: T1820_2[int, Y]) = echo "int"
|
||||||
|
proc intOrFloat*[Y](f: T1820_2[float, Y]) = echo "float"
|
||||||
|
proc yinOrYang*[T](f: T1820_2[T, YinAndYang.Yin]) = echo "yin"
|
||||||
|
proc yinOrYang*[T](f: T1820_2[T, Yang]) = echo "yang"
|
||||||
|
|
||||||
|
var foo_2: T1820_2[float, Yin]
|
||||||
|
var foo_3: T1820_2[float, YinAndYang.Yang]
|
||||||
|
|
||||||
|
foo_2.intOrFloat
|
||||||
|
foo_2.yinOrYang
|
||||||
|
foo_3.yinOrYang
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue