This commit is contained in:
Andreas Rumpf 2020-08-01 07:39:00 +02:00 • committed by GitHub
commit 4ab6887a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 24 deletions

View file

@ -663,7 +663,7 @@ proc semRecordCase(c: PContext, n: PNode, check: var IntSet, pos: var int,
internalError(c.config, "semRecordCase: discriminant is no symbol")
return
incl(a[0].sym.flags, sfDiscriminant)
var covered: Int128 = toInt128(0)
var covered = toInt128(0)
var chckCovered = false
var typ = skipTypes(a[0].typ, abstractVar-{tyTypeDesc})
const shouldChckCovered = {tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt32, tyBool}
@ -744,6 +744,8 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int,
father.add n
elif branch != nil:
semRecordNodeAux(c, branch, check, pos, father, rectype, hasCaseFields)
elif father.kind in {nkElse, nkOfBranch}:
father.add newNodeI(nkRecList, n.info)
of nkRecCase:
semRecordCase(c, n, check, pos, father, rectype)
of nkNilLit:
@ -800,7 +802,9 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int,
if containsOrIncl(check, n.sym.name.id):
localError(c.config, n.info, "attempt to redefine: '" & n.sym.name.s & "'")
father.add n
of nkEmpty: discard
of nkEmpty:
if father.kind in {nkElse, nkOfBranch}:
father.add n
else: illFormedAst(n, c.config)
proc addInheritedFieldsAux(c: PContext, check: var IntSet, pos: var int,