From 07eca7decd329521cd95ade8ea243ee30ced28c8 Mon Sep 17 00:00:00 2001 From: Jasper Jenkins Date: Sun, 12 May 2019 23:47:30 -0700 Subject: [PATCH] Fixes #4140 (#11238) * correct error * cleaner * fix line info --- compiler/semtypes.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index e24ecdbdf4..6a27835519 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -610,9 +610,10 @@ proc semRecordCase(c: PContext, n: PNode, check: var IntSet, pos: var int, chckCovered = true of tyFloat..tyFloat128, tyString, tyError: discard - else: - if not isOrdinalType(typ): - localError(c.config, n.info, "selector must be of an ordinal type, float or string") + of tyForward: + errorUndeclaredIdentifier(c, n.sons[0].info, typ.sym.name.s) + elif not isOrdinalType(typ): + localError(c.config, n.sons[0].info, "selector must be of an ordinal type, float or string") for i in 1 ..< sonsLen(n): var b = copyTree(n.sons[i]) addSon(a, b)