aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-30 11:00:18 +0000
committerGitHub <noreply@github.com>2026-01-30 11:00:18 +0000
commitc4952c0b7e91e4e10195593e322c1259d2c9ab33 (patch)
tree247c11fd63a68d31e8c4e603df7372b4b90a43a5 /src/check_type.cpp
parent5d47a2e92dc1e919124af6fceb740830b6ea6886 (diff)
parent19b545e7cb0b09a7c8b3424ca8276b9e37f8de80 (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_type.cpp')
-rw-r--r--src/check_type.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 41c5f48d1..b1d0045e9 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1845,11 +1845,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) {