-
-
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
template generics don't bind generic params on instantiation; causing wrong runtime values or crashes #13527
Labels
Comments
Well I have to say the output is pretty bad. But still, the example does not produce the output of the |
I fixed the top snippet by removing the
|
metagn
added a commit
to metagn/Nim
that referenced
this issue
Aug 23, 2023
fixes nim-lang#13527, fixes nim-lang#17240, fixes nim-lang#6340, fixes nim-lang#20033, fixes nim-lang#19576, fixes nim-lang#19076
metagn
added a commit
to metagn/Nim
that referenced
this issue
Aug 25, 2023
fixes nim-lang#13527, fixes nim-lang#17240, fixes nim-lang#6340, fixes nim-lang#20033, fixes nim-lang#19576, fixes nim-lang#19076
Araq
pushed a commit
that referenced
this issue
Aug 25, 2023
narimiran
pushed a commit
that referenced
this issue
Dec 1, 2023
narimiran
pushed a commit
that referenced
this issue
Dec 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
template generics don't bind generic params on instantiation; causing wrong runtime values or crashes
Example
Current Output
170141183460469231731687303715884105727
Expected Output
other example:
default
gives:
Error: type mismatch: got <int> but expected one of: proc default(T: typedesc): T:type
workarounds are not good
use
type(a)
instead ofT
works in example above but won't work in more general cases eg:but then (despite being bad), that doesn't even work with special cases like
seq[T]
, givingError: undeclared field: 'T'
So you're forced to use the newly introduced
typetraits.genericParams
(see #13433), which seems overkill for these specific cases.note
interestingly,
static[T]
generic params do seem to bind correctly, unlike non-static generic params eg:root cause for:
Additional Information
The text was updated successfully, but these errors were encountered: