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
param.T
type Test[T] = object proc run(self: Test): self.T = discard discard run(Test[int]())
https://play.nim-lang.org/#ix=44m4
As expected
type Test[T] = object proc run[T](self: Test[T]): self.T = discard discard run(Test[int]())
https://play.nim-lang.org/#ix=44m5
/usercode/in.nim(5, 12) template/generic instantiation of `run` from here /usercode/in.nim(3, 29) Error: cannot evaluate at compile time: self
type Test[T] = object proc run(self: Test[auto]): self.T = discard discard run(Test[int]())
https://play.nim-lang.org/#ix=44m6
/usercode/in.nim(3, 33) Error: undeclared field: 'T'
$ nim -v Nim Compiler Version 1.6.6 [Windows: amd64] Compiled at 2022-05-05 Copyright (c) 2006-2021 by Andreas Rumpf active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
workaround:
type Test[T] = object proc run[T](self: Test[T]): T = discard discard run(Test[int]())
Sorry, something went wrong.
Doing
type Test[T] = object proc run[T](self: Test[T]): typeof(self).T = discard discard run(Test[int]())
gives
fatal.nim(53) sysFatal Error: unhandled exception: field 'intVal' is not accessible for type 'TFullReg' using 'kind = rkNode' [FieldDefect]
69ea133
Successfully merging a pull request may close this issue.
With type class
https://play.nim-lang.org/#ix=44m4
Current output
As expected
With generic
https://play.nim-lang.org/#ix=44m5
Current Output
With auto
https://play.nim-lang.org/#ix=44m6
Current Output
The text was updated successfully, but these errors were encountered: