mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-23 21:41:34 +00:00
Merge pull request #7369 from kalsprite/bare_builtin_as_value
check_stmt: reject a built-in procedure assigned to
This commit is contained in:
@@ -444,6 +444,19 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
|
||||
expr_str,
|
||||
LIT(context_name));
|
||||
rhs->mode = Addressing_Invalid;
|
||||
return nullptr;
|
||||
}
|
||||
case Addressing_Builtin: {
|
||||
// a builtin is not a value
|
||||
gbString expr_str = expr_to_string(rhs->expr);
|
||||
defer (gb_string_free(expr_str));
|
||||
|
||||
error(rhs->expr,
|
||||
"Cannot assign built-in procedure '%s' in %.*s",
|
||||
expr_str,
|
||||
LIT(context_name));
|
||||
rhs->mode = Addressing_Invalid;
|
||||
return nullptr;
|
||||
}
|
||||
case Addressing_Invalid:
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user