aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-03-01 14:49:05 +0000
committergingerBill <bill@gingerbill.org>2022-03-01 14:49:05 +0000
commit49fecbdc5e6579956346e484a418b9501dfddd71 (patch)
tree1fa6c1b3db8205acc8cf8486b0b59ba1589c4cc4 /src/check_builtin.cpp
parentd4ccb69ccc56fb57cad48493a9e5e78ca3529a84 (diff)
Improve error message when there is "no field" found for a large anonymous struct
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 69cc40de8..aeeeb9e4d 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -1106,7 +1106,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
Selection sel = lookup_field(type, field_name, false);
if (sel.entity == nullptr) {
- gbString type_str = type_to_string(type);
+ gbString type_str = type_to_string_shorthand(type);
error(ce->args[0],
"'%s' has no field named '%.*s'", type_str, LIT(field_name));
gb_string_free(type_str);
@@ -1118,7 +1118,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
return false;
}
if (sel.indirect) {
- gbString type_str = type_to_string(type);
+ gbString type_str = type_to_string_shorthand(type);
error(ce->args[0],
"Field '%.*s' is embedded via a pointer in '%s'", LIT(field_name), type_str);
gb_string_free(type_str);
@@ -1179,7 +1179,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
Selection sel = lookup_field(type, field_name, false);
if (sel.entity == nullptr) {
- gbString type_str = type_to_string(type);
+ gbString type_str = type_to_string_shorthand(type);
error(ce->args[0],
"'%s' has no field named '%.*s'", type_str, LIT(field_name));
gb_string_free(type_str);
@@ -1191,7 +1191,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
return false;
}
if (sel.indirect) {
- gbString type_str = type_to_string(type);
+ gbString type_str = type_to_string_shorthand(type);
error(ce->args[0],
"Field '%.*s' is embedded via a pointer in '%s'", LIT(field_name), type_str);
gb_string_free(type_str);