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

whitelist generic params matching typedesc for templates/macros #23438

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Mar 25, 2024

fixes #23432

After #22029 generic parameter types no longer match typedesc parameters in overloading, as this previously instantiated procs with an unresolved type as a typedesc value. However macros and templates don't use the same mechanism for generic instantiation, cannot delay their instantiations further than the point that they get compiled (i.e. are generically instantiated) and can inspect types more precisely anyway, so for practicality purposes we can whitelist them for typedesc and keep old code working.

If whitelisting macros and templates isn't sufficient (i.e. in cases where c.calleeSym is nil) we can also blacklist runtime routines (c.calleeSym != nil and c.calleeSym.kind in (routineKinds - {skMacro, skTemplate})).

metagn added a commit to metagn/Nim that referenced this pull request Mar 25, 2024
@metagn metagn marked this pull request as ready for review April 6, 2024 00:35
@metagn
Copy link
Collaborator Author

metagn commented Apr 6, 2024

Wrote description, CI failure is probably unrelated

@metagn metagn closed this Apr 6, 2024
@metagn metagn reopened this Apr 6, 2024
@metagn metagn closed this Apr 7, 2024
@metagn metagn reopened this Apr 7, 2024
@metagn metagn closed this May 4, 2024
@metagn metagn reopened this May 4, 2024
@metagn metagn force-pushed the macro-generic-param-typedesc branch from ab43e50 to c007bf5 Compare May 4, 2024 23:28
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.

Invalid expected type, but got: Raising(Future[void], E) on macro returning type (regression from 1.6)
1 participant