diff options
-rw-r--r-- | compiler/sigmatch.nim | 3 | ||||
-rw-r--r-- | tests/concepts/tinfrecursion.nim | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 231dd80f4..97b18306b 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1057,9 +1057,10 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, else: isNone of tyUserTypeClass, tyUserTypeClassInst: - if c.c.matchedConcept != nil: + if c.c.matchedConcept != nil and c.c.matchedConcept.depth <= 4: # consider this: 'var g: Node' *within* a concept where 'Node' # is a concept too (tgraph) + inc c.c.matchedConcept.depth let x = typeRel(c, a, f, flags + {trDontBind}) if x >= isGeneric: return isGeneric diff --git a/tests/concepts/tinfrecursion.nim b/tests/concepts/tinfrecursion.nim new file mode 100644 index 000000000..60db410de --- /dev/null +++ b/tests/concepts/tinfrecursion.nim @@ -0,0 +1,13 @@ + +# bug #6691 +type + ConceptA = concept c + + ConceptB = concept c + c.myProc(ConceptA) + + Obj = object + +proc myProc(obj: Obj, x: ConceptA) = discard + +echo Obj is ConceptB |