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_type.cpp | |
| parent | e138e76f21532527726897421b139fde9d05e7ce (diff) | |
Make `using` as a statement an opt-in with `#+feature using-stmt`
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index af07efd8f..2452cc6d0 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1830,11 +1830,14 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para Type *specialization = nullptr; bool is_using = (p->flags&FieldFlag_using) != 0; - if ((check_vet_flags(param) & VetFlag_UsingParam) && is_using) { - ERROR_BLOCK(); - error(param, "'using' on a procedure parameter is not allowed when '-vet' or '-vet-using-param' is applied"); - error_line("\t'using' is considered bad practice to use as a statement/procedure parameter outside of immediate refactoring\n"); + + u64 feature_flags = check_feature_flags(ctx, param); + + if (is_using && (feature_flags & OptInFeatureFlag_UsingStmt) == 0) { + ERROR_BLOCK(); + error(param, "'using' has been disallowed as it is considered bad practice to use as a statement/procedure parameter 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"); } if (type_expr == nullptr) { |