Skip to content

Commit

Permalink
Treat nkError reaching patterns.sameTrees as bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Clyybber committed Mar 9, 2024
1 parent 4296976 commit 8af2fd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/sem/patterns.nim
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ proc sameTrees*(a, b: PNode): bool =
of nkIntLiterals: result = a.intVal == b.intVal
of nkFloatLiterals: result = a.floatVal == b.floatVal
of nkStrLiterals: result = a.strVal == b.strVal
of nkNone, nkEmpty, nkNilLit, nkCommentStmt, nkError:
result = true # XXX: Should nkCommentStmt, nkError be handled?
of nkNone, nkEmpty, nkNilLit, nkCommentStmt:
result = true # Ignore comments
of nkError:
unreachable()
of nkType: result = sameTypeOrNil(a.typ, b.typ)
of nkWithSons:
if a.len == b.len:
Expand Down

0 comments on commit 8af2fd6

Please sign in to comment.