aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorFrancisTheCat <90558133+FrancisTheCat@users.noreply.github.com>2024-06-14 16:34:21 +0200
committerGitHub <noreply@github.com>2024-06-14 16:34:21 +0200
commitcd5fa8523f79ce981e5047dad5b66155f493d169 (patch)
tree1a8acb79d3bf1b5fca3f0c6ac20bece15a2cbfd2 /src/check_expr.cpp
parentec7b77fc0f6ed20eecf25039c6acbe2050cef877 (diff)
parentff4787070d9673a417f549f1b9452e675c96f992 (diff)
Merge branch 'odin-lang:master' into master
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 01cba881e..359b30276 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -2550,7 +2550,7 @@ gb_internal void check_unary_expr(CheckerContext *c, Operand *o, Token op, Ast *
error_line("\tSuggestion: Did you want to pass the iterable value to the for statement by pointer to get addressable semantics?\n");
}
- if (is_type_map(parent_type)) {
+ if (parent_type != nullptr && is_type_map(parent_type)) {
error_line("\t Prefer doing 'for key, &%.*s in ...'\n", LIT(e->token.string));
} else {
error_line("\t Prefer doing 'for &%.*s in ...'\n", LIT(e->token.string));
@@ -3564,6 +3564,9 @@ gb_internal void check_binary_matrix(CheckerContext *c, Token const &op, Operand
x->mode = Addressing_Value;
if (are_types_identical(xt, yt)) {
+ if (are_types_identical(x->type, y->type)) {
+ return;
+ }
if (!is_type_named(x->type) && is_type_named(y->type)) {
// prefer the named type
x->type = y->type;