attempt to fix #5632 typedesc typeRel regression (#5634)

This commit is contained in:
andri lim
2017-04-01 02:58:26 +07:00
committed by Andreas Rumpf
parent fce4b7cd62
commit 2f9a698e87
2 changed files with 13 additions and 1 deletions

View File

@@ -1268,7 +1268,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
# crossing path with metatypes/aliases, so we need to separate them
# by checking sym.id
let genericSubtype = isGenericSubType(c, x, f, depth, f)
if not (genericSubtype and aobj.sym.id != fobj.sym.id):
if not (genericSubtype and aobj.sym.id != fobj.sym.id) and aOrig.kind != tyGenericBody:
depth = -1
if depth >= 0:

View File

@@ -0,0 +1,12 @@
discard """
output: '''OK'''
"""
#bug #5632
type
Option*[T] = object
proc point*[A](v: A, t: typedesc[Option[A]]): Option[A] =
discard
discard point(1, Option)
echo "OK"