mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 16:48:18 +00:00
Fix issue with mixture of named and unnamed parameters for a struct literal
This commit is contained in:
+5
-4
@@ -5356,6 +5356,8 @@ bool ternary_compare_types(Type *x, Type *y) {
|
||||
return are_types_identical(x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type *type_hint) {
|
||||
ExprKind kind = Expr_Stmt;
|
||||
|
||||
@@ -5646,7 +5648,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_type_struct(t)) { // Checker values
|
||||
|
||||
isize field_count = t->Struct.fields.count;
|
||||
isize min_field_count = t->Struct.fields.count;
|
||||
for (isize i = min_field_count-1; i >= 0; i--) {
|
||||
@@ -5718,8 +5720,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
||||
Ast *elem = cl->elems[index];
|
||||
if (elem->kind == Ast_FieldValue) {
|
||||
seen_field_value = true;
|
||||
// error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
|
||||
// continue;
|
||||
error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
|
||||
continue;
|
||||
} else if (seen_field_value) {
|
||||
error(elem, "Value elements cannot be used after a 'field = value'");
|
||||
continue;
|
||||
@@ -5754,7 +5756,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user