Issue not correctly aborting compilation on recursive generics.

This commit is contained in:
Christoffer Lerno
2025-09-22 21:11:48 +02:00
committed by Christoffer Lerno
parent 44d736a537
commit eaeafb7299
3 changed files with 24 additions and 0 deletions

View File

@@ -38,6 +38,7 @@
- Taking `.ordinal` from an enum passed by pointer and then taking the address of this result would return the enum, not int.
- Alias and distinct types didn't check the underlying type wasn't compile time or optional.
- Incorrect nameof on nested struct names. #2492
- Issue not correctly aborting compilation on recursive generics.
### Stdlib changes
- Added generic `InterfaceList` to store a list of values that implement a specific interface

View File

@@ -5207,6 +5207,7 @@ Decl *sema_analyse_parameterized_identifier(SemaContext *c, Path *decl_path, con
if (stage > ANALYSIS_POST_REGISTER)
{
sema_analyze_stage(instantiated_module, stage);
if (compiler.context.errors_found) return poisoned_decl;
}
}

View File

@@ -0,0 +1,22 @@
module foo { Type };
import std::collections::list;
struct Foo {
Type foo;
Allocator allocator;
List { Foo } children; // #error: Recursive definition of 'Foo'
}
module test;
import std::collections::list;
import foo;
fn int main(String[] args)
{
Foo { int } test;
// assume we add children here but it's irrelevant for the repro
Foo {int} [] range = test.children[4:20];
return 0;
}