-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
generic, compile-time proc creates "cannot generate VM code for T" error #19365
Comments
Apparently this also fails? proc f[T](x: static T) = discard |
metagn
added a commit
to metagn/Nim
that referenced
this issue
Jun 13, 2023
metagn
added a commit
to metagn/Nim
that referenced
this issue
Aug 16, 2024
Araq
pushed a commit
that referenced
this issue
Aug 17, 2024
fixes #10753, fixes #22021, refs #19365 (was fixed by #22029, but more faithful test added) For whatever reason `compileTime` proc calls did not fold if the proc was generic ([since this folding was introduced](c25ffbf#diff-539da3a63df08fa987f1b0c67d26cdc690753843d110b6bf0805a685eeaffd40)). I'm guessing the intention was for *unresolved* generic procs to not fold, which is now the logic. Non-magic `compileTime` procs also now don't fold at compile time in `typeof` contexts to avoid possible runtime errors (only the important) and prevent double/needless evaluation.
narimiran
pushed a commit
that referenced
this issue
Sep 13, 2024
fixes #10753, fixes #22021, refs #19365 (was fixed by #22029, but more faithful test added) For whatever reason `compileTime` proc calls did not fold if the proc was generic ([since this folding was introduced](c25ffbf#diff-539da3a63df08fa987f1b0c67d26cdc690753843d110b6bf0805a685eeaffd40)). I'm guessing the intention was for *unresolved* generic procs to not fold, which is now the logic. Non-magic `compileTime` procs also now don't fold at compile time in `typeof` contexts to avoid possible runtime errors (only the important) and prevent double/needless evaluation. (cherry picked from commit f7c11a8)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A compile-time procedure with a generic, static type compiles with a VM code generation error.
Example
Current Output
Expected Output
Successful compilation.
Tested with Nim versions:
The text was updated successfully, but these errors were encountered: