mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Warn on redundant auto_cast, and make an error on -vet
This commit is contained in:
@@ -10075,7 +10075,16 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
|||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
if (type_hint) {
|
if (type_hint) {
|
||||||
|
Type *type = type_of_expr(ac->expr);
|
||||||
check_cast(c, o, type_hint);
|
check_cast(c, o, type_hint);
|
||||||
|
if (is_type_typed(type) && are_types_identical(type, type_hint)) {
|
||||||
|
if (build_context.vet) {
|
||||||
|
error(node, "Redundant 'auto_cast' applied to expression");
|
||||||
|
} else {
|
||||||
|
warning(node, "Redundant 'auto_cast' applied to expression");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
o->expr = node;
|
o->expr = node;
|
||||||
return Expr_Expr;
|
return Expr_Expr;
|
||||||
|
|||||||
Reference in New Issue
Block a user