mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add x: T; y: ^T = x suggestion to do &x
This commit is contained in:
@@ -2248,6 +2248,12 @@ gb_internal void check_assignment_error_suggestion(CheckerContext *c, Operand *o
|
|||||||
gbString s = expr_to_string(c->type_hint_expr);
|
gbString s = expr_to_string(c->type_hint_expr);
|
||||||
error_line("\tSuggestion: make sure that `%s` is attached to the compound literal directly\n", s);
|
error_line("\tSuggestion: make sure that `%s` is attached to the compound literal directly\n", s);
|
||||||
gb_string_free(s);
|
gb_string_free(s);
|
||||||
|
} else if (is_type_pointer(type) &&
|
||||||
|
o->mode == Addressing_Variable &&
|
||||||
|
are_types_identical(type_deref(type), o->type)) {
|
||||||
|
gbString s = expr_to_string(o->expr);
|
||||||
|
error_line("\tSuggestion: Did you mean `&%s`\n", s);
|
||||||
|
gb_string_free(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user