* correct error

* cleaner

* fix line info
This commit is contained in:
Jasper Jenkins
2019-05-12 23:47:30 -07:00
committed by cooldome
parent 0c869eaa47
commit 07eca7decd

View File

@@ -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)