From 6169d7acdf2d089338fc31bebf182bea214ca417 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Mon, 20 Oct 2025 00:19:51 +0200 Subject: [PATCH] Correctly mention aliased type when method is not implemented #2534. --- releasenotes.md | 1 + src/compiler/sema_expr.c | 2 +- test/test_suite/struct/missing_access.c3 | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/test_suite/struct/missing_access.c3 diff --git a/releasenotes.md b/releasenotes.md index 1967d66c5..c2a632dca 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -22,6 +22,7 @@ - Fix issues with linking when using symbol aliases. #2519 - Splatting optional compile-time macro parameter from inside lambda expression does not work #2532. - Compiler segfault when getting a nonexistant member from an unnamed struct #2533. +- Correctly mention aliased type when method is not implemented #2534. ### Stdlib changes - Sorting functions correctly took slices by value, but also other types by value. Now, only slices are accepted by value, other containers are always by ref. diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 1c185cc38..7b4d29433 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -6272,7 +6272,7 @@ CHECK_DEEPER: if (!method) { if (missing_ref) goto MISSING_REF; - RETURN_SEMA_ERROR(expr, "There is no member or method '%s' on '%s'", kw, type_to_error_string(parent->type)); + RETURN_SEMA_ERROR(expr, "There is no member or method '%s' on %s", kw, type_quoted_error_string(parent->type)); } ASSERT_SPAN(expr, expr->expr_kind == EXPR_ACCESS_UNRESOLVED); diff --git a/test/test_suite/struct/missing_access.c3 b/test/test_suite/struct/missing_access.c3 new file mode 100644 index 000000000..06a1298f5 --- /dev/null +++ b/test/test_suite/struct/missing_access.c3 @@ -0,0 +1,7 @@ +alias MyChar = char; + +fn void main() +{ + MyChar my = '1'; + my.ok(); // #error: There is no member or method 'ok' on 'MyChar' (char) +} \ No newline at end of file