fix static[Slice[T]] as argument issue (#15842)
This commit is contained in:
parent
f17555770e
commit
4c19c5dfae
2 changed files with 13 additions and 1 deletions
|
|
@ -1079,7 +1079,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||||
return typeRel(c, f, lastSon(aOrig), flags)
|
return typeRel(c, f, lastSon(aOrig), flags)
|
||||||
|
|
||||||
if a.kind == tyGenericInst and
|
if a.kind == tyGenericInst and
|
||||||
skipTypes(f, {tyVar, tyLent, tySink}).kind notin {
|
skipTypes(f, {tyStatic, tyVar, tyLent, tySink}).kind notin {
|
||||||
tyGenericBody, tyGenericInvocation,
|
tyGenericBody, tyGenericInvocation,
|
||||||
tyGenericInst, tyGenericParam} + tyTypeClasses:
|
tyGenericInst, tyGenericParam} + tyTypeClasses:
|
||||||
return typeRel(c, f, lastSon(a), flags)
|
return typeRel(c, f, lastSon(a), flags)
|
||||||
|
|
|
||||||
|
|
@ -109,3 +109,15 @@ block:
|
||||||
doAssert Foo2[int,float|int] is Foo
|
doAssert Foo2[int,float|int] is Foo
|
||||||
doAssert Foo2[int,float|int] isnot Bar
|
doAssert Foo2[int,float|int] isnot Bar
|
||||||
doAssert int is (int|float)
|
doAssert int is (int|float)
|
||||||
|
|
||||||
|
|
||||||
|
block:
|
||||||
|
# Slice[T] as static type issue
|
||||||
|
type
|
||||||
|
MyEnum = enum
|
||||||
|
x1, x2, x3, x4, x5, x6
|
||||||
|
|
||||||
|
proc enumGen[T: enum](s: static[Slice[T]]) =
|
||||||
|
doAssert($s.a & " " & $s.b == "x1 x3")
|
||||||
|
|
||||||
|
enumGen(x1..x3)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue