From a84179de1fdf9674bd25a9cebb672bf190d4bade Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Sun, 15 Feb 2026 16:37:14 +0100 Subject: Do not allow duplicate #partial directives on switch statement --- src/parser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 159eb65f8..fe42739b8 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -5427,9 +5427,15 @@ gb_internal Ast *parse_stmt(AstFile *f) { s = parse_stmt(f); switch (s->kind) { case Ast_SwitchStmt: + if (s->SwitchStmt.partial) { + syntax_error(token, "#partial already applied to a switch statement"); + } s->SwitchStmt.partial = true; break; case Ast_TypeSwitchStmt: + if (s->TypeSwitchStmt.partial) { + syntax_error(token, "#partial already applied to a switch statement"); + } s->TypeSwitchStmt.partial = true; break; case Ast_EmptyStmt: -- cgit v1.2.3