Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semcheck substitution output of invoked generic types #332

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Jan 6, 2025

This allows things like nested generics to compile due to converting InvokeT types to sym types.

The symbol is saved to the type instantiation cache before semchecking so that recursive types do not try to infinitely create a new instantiation. However the type symbol cannot be loaded until the semchecking is done, so if anything tries to introspect the type in its own definition it will fail when trying to load it. For now this is not an issue. Maybe a solution is to perform a SemcheckTopLevelSyms phase on the substituted type first, though the AST of the symbol would then be substituted but not semchecked type AST.

A followup would be to inline the produced types if they are structural instead of giving their symbols. Edit: Actually this is just a semTypeSym call, and requires getting the symbol AST which needs the SemcheckTopLevelSyms phase anyway. Can do these here or in a followup: #333

@Araq Araq merged commit 3e0e21a into nim-lang:master Jan 6, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants