bugfix: constraint matching for tyGenericInst; implements #130
This commit is contained in:
parent
b9e7f30dda
commit
c9513c2e5a
3 changed files with 32 additions and 2 deletions
|
|
@ -198,7 +198,14 @@ proc semTypeIdent(c: PContext, n: PNode): PSym =
|
|||
return result.typ.sym
|
||||
else:
|
||||
return result.typ.sym
|
||||
if result.kind != skType: GlobalError(n.info, errTypeExpected)
|
||||
if result.kind != skType:
|
||||
# this implements the wanted ``var v: V, x: V`` feature ...
|
||||
var ov: TOverloadIter
|
||||
var amb = InitOverloadIter(ov, c, n)
|
||||
while amb != nil and amb.kind != skType:
|
||||
amb = nextOverloadIter(ov, c, n)
|
||||
if amb != nil: result = amb
|
||||
else: GlobalError(n.info, errTypeExpected)
|
||||
if result.typ.kind != tyGenericParam:
|
||||
# XXX get rid of this hack!
|
||||
reset(n[])
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ proc tupleRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
|||
proc matchTypeClass(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||
for i in countup(0, f.sonsLen - 1):
|
||||
let son = f.sons[i]
|
||||
var match = son.kind == skipTypes(a, {tyRange}).kind
|
||||
var match = son.kind == skipTypes(a, {tyRange, tyGenericInst}).kind
|
||||
|
||||
if not match:
|
||||
case son.kind
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue