- Error message with hashmap shows "mangled" name instead of original #2562.

This commit is contained in:
Christoffer Lerno
2025-11-04 23:19:57 +01:00
parent 5070840da9
commit 07363c6ecd
3 changed files with 19 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
- Fix division-by-zero checks on `a /= 0` and `b /= 0f` #2558.
- Fix fmod `a %= 0f`.
- Regression vector ABI: initializing a struct containing a NPOT vector with a constant value would crash LLVM. #2559
- Error message with hashmap shows "mangled" name instead of original #2562.
### Stdlib changes

View File

@@ -355,7 +355,14 @@ static const char *type_to_error_string_with_path(Type *type)
Decl *decl = type->decl;
const char *suffix = decl->unit->module->generic_suffix;
scratch_buffer_clear();
scratch_buffer_append(decl->unit->module->name->module);
if (decl->unit->module->generic_module)
{
scratch_buffer_append(decl->unit->module->generic_module->name->module);
}
else
{
scratch_buffer_append(decl->unit->module->name->module);
}
scratch_buffer_append("::");
if (suffix || type_is_inner_type(type))
{

View File

@@ -0,0 +1,10 @@
module test;
import std::collections::map;
fn void foo(HashMap{char[], String}* f) { }
fn void main()
{
HashMap{char[], char[]} x;
foo(&x); // #error: Implicitly casting 'std::collections::map::HashMap{char[], char[]}*' to 'std::collections::map::HashMap{char[], String}*' is not permitted, but you may do an explicit cast by placing '(std::collections::map::HashMap{char[], String}*)' before the expression
}