From 1c0b81528224703f433ddc56e40aba59aec76081 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 18 Sep 2015 01:50:28 +0200 Subject: [PATCH] fixes #3305; error message will improve with later improvements for concepts --- compiler/sigmatch.nim | 3 +++ 1 file changed, 3 insertions(+) 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