mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
Disallow for x in y.(T) and for x in y.?
This commit is contained in:
@@ -1546,10 +1546,13 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
|
||||
}
|
||||
} else if (operand.mode != Addressing_Invalid) {
|
||||
if (operand.mode == Addressing_OptionalOk || operand.mode == Addressing_OptionalOkPtr) {
|
||||
Type *end_type = nullptr;
|
||||
check_promote_optional_ok(ctx, &operand, nullptr, &end_type, false);
|
||||
if (is_type_boolean(end_type)) {
|
||||
check_promote_optional_ok(ctx, &operand, nullptr, &end_type, true);
|
||||
Ast *expr = unparen_expr(operand.expr);
|
||||
if (expr->kind != Ast_TypeAssertion) { // Only for procedure calls
|
||||
Type *end_type = nullptr;
|
||||
check_promote_optional_ok(ctx, &operand, nullptr, &end_type, false);
|
||||
if (is_type_boolean(end_type)) {
|
||||
check_promote_optional_ok(ctx, &operand, nullptr, &end_type, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
bool is_ptr = is_type_pointer(operand.type);
|
||||
|
||||
Reference in New Issue
Block a user