diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-21 11:53:44 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-12-21 11:53:44 +0000 |
| commit | d139c72fc24fdb574861ac22fc11b91de944b2a4 (patch) | |
| tree | e6bdc024d3736998d7830bd7fc9c086676dd3fbf /src/check_stmt.cpp | |
| parent | e138e76f21532527726897421b139fde9d05e7ce (diff) | |
Make `using` as a statement an 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 835f0162a..26860db4f 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2943,10 +2943,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) { |