From 2dca39b55716d84e760d3a33b9754c18d7f6f1cc Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 16 Jan 2023 12:06:03 +0000 Subject: Remove `auto_cast` procedure field flag Fixes #2285 --- src/check_type.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 0bd9af15f..ad746514e 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1619,10 +1619,6 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para } } - if (p->flags&FieldFlag_auto_cast) { - error(name, "'auto_cast' can only be applied to variable fields"); - p->flags &= ~FieldFlag_auto_cast; - } if (p->flags&FieldFlag_const) { error(name, "'#const' can only be applied to variable fields"); p->flags &= ~FieldFlag_const; @@ -1681,11 +1677,7 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para } if (type != t_invalid && !check_is_assignable_to(ctx, &op, type)) { bool ok = true; - if (p->flags&FieldFlag_auto_cast) { - if (!check_is_castable_to(ctx, &op, type)) { - ok = false; - } - } else if (p->flags&FieldFlag_any_int) { + if (p->flags&FieldFlag_any_int) { if ((!is_type_integer(op.type) && !is_type_enum(op.type)) || (!is_type_integer(type) && !is_type_enum(type))) { ok = false; } else if (!check_is_castable_to(ctx, &op, type)) { @@ -1731,10 +1723,6 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para error(name, "'#no_alias' can only be applied to non constant values"); p->flags &= ~FieldFlag_no_alias; // Remove the flag } - if (p->flags&FieldFlag_auto_cast) { - error(name, "'auto_cast' can only be applied to variable fields"); - p->flags &= ~FieldFlag_auto_cast; - } if (p->flags&FieldFlag_any_int) { error(name, "'#any_int' can only be applied to variable fields"); p->flags &= ~FieldFlag_any_int; @@ -1765,9 +1753,6 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para if (p->flags&FieldFlag_no_alias) { param->flags |= EntityFlag_NoAlias; } - if (p->flags&FieldFlag_auto_cast) { - param->flags |= EntityFlag_AutoCast; - } if (p->flags&FieldFlag_any_int) { if (!is_type_integer(param->type) && !is_type_enum(param->type)) { gbString str = type_to_string(param->type); -- cgit v1.2.3