support for matching generic types' procs in generic concepts

This commit is contained in:
Zahary Karadjov 2016-07-31 02:13:32 +03:00
commit 0a9a878bd3
5 changed files with 145 additions and 11 deletions

View file

@ -319,11 +319,11 @@ proc isOpImpl(c: PContext, n: PNode): PNode =
result = newIntNode(nkIntLit, 0)
else:
var rhsOrigType = n[2].typ
discard inferTypeClassParam(c, t1, rhsOrigType)
var t2 = rhsOrigType.skipTypes({tyTypeDesc})
maybeLiftType(t2, c, n.info)
var m: TCandidate
initCandidate(c, m, t2)
discard inferTypeClassParam(m, t1, rhsOrigType)
let match = typeRel(m, t2, t1) >= isSubtype # isNone
result = newIntNode(nkIntLit, ord(match))
@ -912,8 +912,6 @@ const
tyTypeParamsHolders = {tyGenericInst, tyUserTypeClassInst, tyCompositeTypeClass}
tyDotOpTransparent = {tyVar, tyPtr, tyRef, tyAlias}
proc readTypeParameter(c: PContext, typ: PType,
paramName: PIdent, info: TLineInfo): PNode =
let ty = if typ.kind in {tyGenericInst, tyUserTypeClassInst}: typ.skipGenericAlias