diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-01-30 11:00:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-30 11:00:18 +0000 |
| commit | c4952c0b7e91e4e10195593e322c1259d2c9ab33 (patch) | |
| tree | 247c11fd63a68d31e8c4e603df7372b4b90a43a5 /src/check_stmt.cpp | |
| parent | 5d47a2e92dc1e919124af6fceb740830b6ea6886 (diff) | |
| parent | 19b545e7cb0b09a7c8b3424ca8276b9e37f8de80 (diff) | |
Merge pull request #6048 from odin-lang/bill/feature-using-stmt
Make `using` as a statement opt-in with `#+feature using-stmt`
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 2dc621a84..1f433df36 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2945,10 +2945,12 @@ gb_internal void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) error(us->token, "Empty 'using' list"); return; } - if (check_vet_flags(node) & VetFlag_UsingStmt) { + + u64 feature_flags = check_feature_flags(ctx, node); + if ((feature_flags & OptInFeatureFlag_UsingStmt) == 0) { ERROR_BLOCK(); - error(node, "'using' as a statement is not allowed when '-vet' or '-vet-using' is applied"); - error_line("\t'using' is considered bad practice to use as a statement outside of immediate refactoring\n"); + error(node, "'using' has been disallowed as it is considered bad practice to use as a statement outside of immediate refactoring"); + error_line("\tIt you do require it for refactoring purposes or legacy code, it can be enabled on a per-file basis with '#+feature using-stmt'\n"); } for (Ast *expr : us->list) { |