From 8af2fd643d5fc411330b2eaa56972b9cd9fc6db5 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Sat, 9 Mar 2024 01:36:22 +0100 Subject: [PATCH] Treat nkError reaching patterns.sameTrees as bug --- compiler/sem/patterns.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/sem/patterns.nim b/compiler/sem/patterns.nim index b2d09f18c6d39..af41d94f0130c 100644 --- a/compiler/sem/patterns.nim +++ b/compiler/sem/patterns.nim @@ -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: