Skip to content

Commit 2f9a698

Browse files
jangkoAraq
authored andcommitted
attempt to fix #5632 typedesc typeRel regression (#5634)
1 parent fce4b7c commit 2f9a698

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/sigmatch.nim

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

12741274
if depth >= 0:

tests/generics/tobjecttyperel3.nim

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
discard """
2+
output: '''OK'''
3+
"""
4+
#bug #5632
5+
type
6+
Option*[T] = object
7+
8+
proc point*[A](v: A, t: typedesc[Option[A]]): Option[A] =
9+
discard
10+
11+
discard point(1, Option)
12+
echo "OK"

0 commit comments

Comments
 (0)