diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-04 20:24:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 20:24:44 +0200 |
| commit | 1a35c7f95487f75081d4c703c13bcbed335088f8 (patch) | |
| tree | 7b708896bdc005bc9471f26e0f33cc1f2f231908 /src/check_stmt.cpp | |
| parent | 4838f6b5428293d96b31952a65a02af04d2bbefa (diff) | |
| parent | d046214f67baf9c580605fa4294818e7a12fc434 (diff) | |
Merge pull request #5279 from Feoramund/fix-4673
Be strict with type switch case column alignment too
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 6cacef3ee..d92edf41d 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1593,6 +1593,20 @@ gb_internal void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_ error_line("\tSuggestion: Was '#partial switch' wanted?\n"); } } + + if (build_context.strict_style) { + Token stok = ss->token; + for_array(i, bs->stmts) { + Ast *stmt = bs->stmts[i]; + if (stmt->kind != Ast_CaseClause) { + continue; + } + Token ctok = stmt->CaseClause.token; + if (ctok.pos.column > stok.pos.column) { + error(ctok, "With '-strict-style', 'case' statements must share the same column as the 'switch' token"); + } + } + } } gb_internal void check_block_stmt_for_errors(CheckerContext *ctx, Ast *body) { |