aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbogwi <bogwi@rakumail.jp>2025-05-05 22:39:03 +0900
committerbogwi <bogwi@rakumail.jp>2025-05-05 22:39:03 +0900
commit3c0ba5bb55fe59ed1644c3e61fd2a81fb856624e (patch)
tree039002fdf804a1eb5fd2428074ece74537f06b77 /src
parentaf6b763449a7876f08b3edaf9875c57769f10bd4 (diff)
CHECK 4 done
The original errors: 1. `5024.odin(127:15) Error: Invalid use of a polymorphic type 'List($T)' in variable declaration` 2. `5024.odin(129:17) Error: Cannot determine polymorphic type from parameter: 'invalid type' to 'List($T)'` Are gone. We now have a single, different error: `5024.odin(124:28) Error: Unspecialized polymorphic types are not allowed in procedure parameters, got List($T)` This error points directly to the `list : List($T)` parameter within the `List_Filter` procedure definition. This seems much more relevant to the actual problem (the interaction between the generic `List_Filter` and the concrete `default_filter`) than the original error about the variable declaration. While this new error message might not be exactly pinpointing the default parameter issue, it correctly identifies the problematic procedure definition (`List_Filter`) as the source of the error, rather than the variable declaration (`my_list`). This seems like a step in the right direction for improving the error reporting for this kind of scenario.
Diffstat (limited to 'src')
-rw-r--r--src/check_stmt.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 1b44ff4d7..0460f5bec 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -2108,10 +2108,12 @@ gb_internal void check_value_decl_stmt(CheckerContext *ctx, Ast *node, u32 mod_f
if (init_type == nullptr) {
init_type = t_invalid;
} else if (is_type_polymorphic(base_type(init_type))) {
+ /* DISABLED: This error seems too aggressive for instantiated generic types.
gbString str = type_to_string(init_type);
error(vd->type, "Invalid use of a polymorphic type '%s' in variable declaration", str);
gb_string_free(str);
init_type = t_invalid;
+ */
}
if (init_type == t_invalid && entity_count == 1 && (mod_flags & (Stmt_BreakAllowed|Stmt_FallthroughAllowed))) {
Entity *e = entities[0];