Fix #2662: Don't convert subtype typedesc params
There is no point to issue implicit HiddenStdConv encountering subtype of typedesc[Base] parameter on overload resolution, since this will anyway never reach codegen. This change effectively fixes compiler bug for: iterator it(T: typedesc[Base]) = ... for s in it(SubclassOfBase): ... Where HiddenStdConv triggered implicit instantiation of variable of type typedesc[Base] in for transform, that eventually fails at getUniqueType, that refuses to work for typedesc.
This commit is contained in:
parent
0bf78e2629
commit
179d82c55b
1 changed files with 4 additions and 1 deletions
|
|
@ -1281,7 +1281,10 @@ proc paramTypesMatchAux(m: var TCandidate, f, argType: PType,
|
|||
result = implicitConv(nkHiddenStdConv, f, arg, m, c)
|
||||
of isSubtype:
|
||||
inc(m.subtypeMatches)
|
||||
result = implicitConv(nkHiddenSubConv, f, arg, m, c)
|
||||
if f.kind == tyTypeDesc:
|
||||
result = arg
|
||||
else:
|
||||
result = implicitConv(nkHiddenSubConv, f, arg, m, c)
|
||||
of isSubrange:
|
||||
inc(m.subtypeMatches)
|
||||
if f.kind == tyVar:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue