mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Incorrect error message when using generic type that isn't imported #2589
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
- Improve error message for `Foo{}` when `Foo` is not a generic type #2574.
|
- Improve error message for `Foo{}` when `Foo` is not a generic type #2574.
|
||||||
- Support `@param` directives for `...` parameters. #2578
|
- Support `@param` directives for `...` parameters. #2578
|
||||||
- Allow splatting of structs. #2555
|
- Allow splatting of structs. #2555
|
||||||
|
- Deprecate `--test-nocapture` in favour of `--test-show-output` #2588.
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable.
|
- `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable.
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
- Fix issue when tests encounter a segmentation fault or similar.
|
- Fix issue when tests encounter a segmentation fault or similar.
|
||||||
- With project.json, when overriding with an empty list the base settings would still be used. #2583
|
- With project.json, when overriding with an empty list the base settings would still be used. #2583
|
||||||
- Add sigsegv stacktrace in test and regular errors for Darwin Arm64. #1105
|
- Add sigsegv stacktrace in test and regular errors for Darwin Arm64. #1105
|
||||||
|
- Incorrect error message when using generic type that isn't imported #2589
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
- Add `CGFloat` `CGPoint` `CGSize` `CGRect` types to core_foundation (macOS).
|
- Add `CGFloat` `CGPoint` `CGSize` `CGRect` types to core_foundation (macOS).
|
||||||
@@ -66,7 +68,6 @@
|
|||||||
- The option `--riscvfloat` renamed `--riscv-abi`.
|
- The option `--riscvfloat` renamed `--riscv-abi`.
|
||||||
- Add initial `--cpu-flags` allowing fine grained control over CPU features.
|
- Add initial `--cpu-flags` allowing fine grained control over CPU features.
|
||||||
- Add `--riscv-cpu` settings for RISC-V processors #2549.
|
- Add `--riscv-cpu` settings for RISC-V processors #2549.
|
||||||
- Deprecate `--test-nocapture` in favour of `--test-show-output` #2588.
|
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Bug in `io::write_using_write_byte`.
|
- Bug in `io::write_using_write_byte`.
|
||||||
|
|||||||
@@ -658,15 +658,18 @@ static void sema_report_error_on_decl(SemaContext *context, NameResolve *name_re
|
|||||||
}
|
}
|
||||||
if (!found && name_resolve->maybe_decl)
|
if (!found && name_resolve->maybe_decl)
|
||||||
{
|
{
|
||||||
const char *maybe_name = decl_to_name(name_resolve->maybe_decl);
|
Decl *decl = name_resolve->maybe_decl;
|
||||||
if (name_resolve->maybe_decl->unit->module->generic_module)
|
Module *module = decl->unit->module;
|
||||||
|
const char *maybe_name = decl_to_name(decl);
|
||||||
|
Module *generic_module = module->generic_module;
|
||||||
|
if (!generic_module && module->is_generic) generic_module = module;
|
||||||
|
const char *module_name = generic_module ? generic_module->name->module : module->name->module;
|
||||||
|
if (generic_module && !name_resolve->is_parameterized)
|
||||||
{
|
{
|
||||||
const char *module_name = name_resolve->maybe_decl->unit->module->generic_module->name->module;
|
|
||||||
sema_error_at(context, span, "Did you mean the %s '%s' in the generic module %s? If so, use '%s{...}' instead.",
|
sema_error_at(context, span, "Did you mean the %s '%s' in the generic module %s? If so, use '%s{...}' instead.",
|
||||||
maybe_name, symbol, module_name, symbol);
|
maybe_name, symbol, module_name, symbol);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *module_name = name_resolve->maybe_decl->unit->module->name->module;
|
|
||||||
if (path_name)
|
if (path_name)
|
||||||
{
|
{
|
||||||
sema_error_at(context, span, "Did you mean the %s '%s::%s' in module %s? If so please add 'import %s'.",
|
sema_error_at(context, span, "Did you mean the %s '%s::%s' in module %s? If so please add 'import %s'.",
|
||||||
|
|||||||
31
test/test_suite/generic/generic_lookup.c3
Normal file
31
test/test_suite/generic/generic_lookup.c3
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
module test;
|
||||||
|
|
||||||
|
fn void a()
|
||||||
|
{
|
||||||
|
List {int} x; // #error: Did you mean the struct 'List' in module std::collections::list? If so please add
|
||||||
|
}
|
||||||
|
|
||||||
|
fn void b()
|
||||||
|
{
|
||||||
|
list::ONHEAP{int}; // #error: Did you mean the constant 'std::collections::list::ONHEAP' in module std::collections::list?
|
||||||
|
}
|
||||||
|
|
||||||
|
fn void c()
|
||||||
|
{
|
||||||
|
list::type_is_overaligned{int}(); // #error: Did you mean the macro 'std::collections::list::type_is_overaligned' in module std::collections::list?
|
||||||
|
}
|
||||||
|
|
||||||
|
fn void d()
|
||||||
|
{
|
||||||
|
list::type_is_overaligned(); // #error: Did you mean the macro 'type_is_overaligned' in the generic module std::collections::list? If so, use 'type_is_overaligned{...}' instead
|
||||||
|
}
|
||||||
|
|
||||||
|
fn void e()
|
||||||
|
{
|
||||||
|
List x; // #error: Did you mean the struct 'List' in the generic module std::collections::list? If so, use 'List{...}'
|
||||||
|
}
|
||||||
|
|
||||||
|
fn int main(String[] args)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user