We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using generics in template where instantiate a object with generics got a compile error
type Maybe* [T] = object {. final .} case hasValue*: bool of true: value*: T else: discard proc Just* [T](aValue: T): Maybe[T] {. inline .} = result = Maybe[T](hasValue: true, value: aValue) template template_Just* [T](aValue: T): Maybe[T] = Maybe[T](hasValue: true, value: aValue) proc Nothing* [T]: Maybe[T] {. inline .} = result = Maybe[T](hasValue: false) echo Just[int](1) echo template_Just[int](1)
Hint: used config file 'C:\Users\a72c\scoop\apps\nim\current\config\nim.cfg' [Conf] Hint: system [Processing] Hint: issueTemplateGenerics [Processing] issueTemplateGenerics.nim(22, 24) template/generic instantiation from here issueTemplateGenerics.nim(13, 8) Error: cannot instantiate Maybe got: <int> but expected: <T>
Code compiled with Nim (nim 0.19.2)
(hasValue: true, value: 1) (hasValue: true, value: 1)
See here code compiled with Nim (nim 0.16.0)
The text was updated successfully, but these errors were encountered:
Duplicate of #5926?
Sorry, something went wrong.
Yes!!! Thanks
Closing this because it is a duplicate.
No branches or pull requests
Using generics in template where instantiate a object with generics got a compile error
Example
Current Output
Code compiled with Nim (nim 0.19.2)
Expected Output
See here code compiled with Nim (nim 0.16.0)
Possible Solution
Additional Information
The text was updated successfully, but these errors were encountered: