diff --git a/compiler/ast/treetab.nim b/compiler/ast/treetab.nim index ed57453082bb6..7ec94f6074ec1 100644 --- a/compiler/ast/treetab.nim +++ b/compiler/ast/treetab.nim @@ -17,7 +17,7 @@ proc hashTree*(n: PNode): Hash = return result = ord(n.kind) case n.kind - of nkEmpty, nkNilLit, nkType, nkCommentStmt, nkError: + of nkError, nkEmpty, nkNilLit, nkType, nkCommentStmt: discard of nkIdent: result = result !& n.ident.h @@ -43,7 +43,7 @@ proc treesEquivalent(a, b: PNode): bool = result = true elif (a != nil) and (b != nil) and (a.kind == b.kind): case a.kind - of nkEmpty, nkNilLit, nkType, nkCommentStmt, nkError: result = true + of nkError, nkEmpty, nkNilLit, nkType, nkCommentStmt: result = true of nkSym: result = a.sym.id == b.sym.id of nkIdent: result = a.ident.id == b.ident.id of nkIntLiterals: result = a.intVal == b.intVal diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim index beed09f7c3946..1692da69a9ee0 100644 --- a/compiler/ic/ic.nim +++ b/compiler/ic/ic.nim @@ -102,7 +102,7 @@ proc toString*(tree: PackedTree; n: NodePos; m: PackedModule; nesting: int; result.add $tree[pos].kind case tree.nodes[pos].kind - of nkEmpty, nkNilLit, nkType, nkCommentStmt, nkError: discard + of nkError, nkEmpty, nkNilLit, nkType, nkCommentStmt: discard of nkIdent, nkStrLiterals: result.add " " result.add m.strings[LitId tree.nodes[pos].operand] @@ -446,7 +446,7 @@ proc toPackedNode*(n: PNode; ir: var PackedTree; c: var PackedEncoder; m: var Pa return let info = toPackedInfo(n.info, c, m) case n.kind - of nkEmpty, nkNilLit, nkType, nkCommentStmt, nkError: + of nkError, nkEmpty, nkNilLit, nkType, nkCommentStmt: ir.nodes.add PackedNode(kind: n.kind, flags: n.flags, operand: 0, typeId: storeTypeLater(n.typ, c, m), info: info) of nkIdent: @@ -776,7 +776,7 @@ proc loadNodes*(c: var PackedDecoder; g: var PackedModuleGraph; thisModule: int; result.flags = n.flags case k - of nkEmpty, nkNilLit, nkType, nkCommentStmt, nkError: + of nkError, nkEmpty, nkNilLit, nkType, nkCommentStmt: discard of nkIdent: result.ident = getIdent(c.cache, g[thisModule].fromDisk.strings[n.litId]) diff --git a/compiler/sem/guards.nim b/compiler/sem/guards.nim index 5ebd0c976d7e9..74c1c83860988 100644 --- a/compiler/sem/guards.nim +++ b/compiler/sem/guards.nim @@ -447,6 +447,8 @@ proc sameTree*(a, b: PNode): bool = result = true elif a != nil and b != nil and a.kind == b.kind: case a.kind + of nkError: + unreachable() of nkSym: result = a.sym == b.sym if not result and a.sym.magic != mNone: @@ -458,8 +460,6 @@ proc sameTree*(a, b: PNode): bool = of nkType: result = a.typ == b.typ of nkEmpty, nkNilLit, nkCommentStmt: result = true # Ignore comments - of nkError: - unreachable() of nkWithSons: if a.len == b.len: for i in 0..