diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index d28800d9af..642f50330e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -511,6 +511,9 @@ proc typeRangeRel(f, a: PType): TTypeRelation {.noinline.} = proc matchUserTypeClass*(c: PContext, m: var TCandidate, ff, a: PType): TTypeRelation = var body = ff.skipTypes({tyUserTypeClassInst}) + if c.inTypeClass > 20: + localError(body.n[3].info, $body.n[3] & " too nested for type matching") + return isNone openScope(c) inc c.inTypeClass