aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-08-10 23:34:35 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-08-10 23:34:35 +0200
commitf5fe0de0fd508b5d301708c74e67e7314aa52112 (patch)
tree1a9e0c2217b18bfb0213b0c02e6253ad1700af29 /src/check_expr.cpp
parent6918d8aaa6e13fb7529884a436aa20a87e6b6f10 (diff)
add clarity for diverging mismatch error
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 4bce42129..38dc30cfa 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1237,6 +1237,24 @@ gb_internal void check_assignment(CheckerContext *c, Operand *operand, Type *typ
error_line("\t Got: %s\n", s_got);
gb_string_free(s_got);
gb_string_free(s_expected);
+ } else if (same_inputs && same_outputs &&
+ x->Proc.diverging != y->Proc.diverging) {
+
+ gbString s_expected = type_to_string(y);
+ if (y->Proc.diverging) {
+ s_expected = gb_string_appendc(s_expected, " -> !");
+ }
+
+ gbString s_got = type_to_string(x);
+ if (x->Proc.diverging) {
+ s_got = gb_string_appendc(s_got, " -> !");
+ }
+
+ error_line("\tNote: One of the procedures is diverging while the other isn't\n");
+ error_line("\t Expected: %s\n", s_expected);
+ error_line("\t Got: %s\n", s_got);
+ gb_string_free(s_got);
+ gb_string_free(s_expected);
} else if (same_inputs && !same_outputs) {
gbString s_expected = type_to_string(y->Proc.results);
gbString s_got = type_to_string(x->Proc.results);