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
At a certain level nested generics cause causes the typechecker to get stuck #20348
Comments
@Araq We talked about this yesterday but the repro shows it's not a type aliasing issue as we previously thought since |
This is a more realistic repro but it's less contained: import std/[options]
type
F1*[T] = object
call: proc(self:T,callback:proc(self:T))
F2*[T] = object
call: proc(self:T,callback:proc(self:T))
F3*[T] = object
call: proc(self:T,callback:proc(self:T))
type
Functions*[T] = object
a*: Option[F1[T]]
b*: Option[F1[T]]
c*: Option[F1[T]]
d*: Option[F1[T]]
e*: Option[F1[T]]
f*: Option[F1[T]]
g*: Option[F1[T]]
h*: Option[F1[T]]
i*: Option[F2[T]]
j*: Option[F3[T]]
var fs : Functions[int]
fs.j.map(proc(f:F3[int]) = discard) it fails with:
|
This is happening due to the hardcoded |
…'s generic type has been generated by the compiler (nim-lang#20377) Fixes nim-lang#20348
What happened?
This is a contrived example but please bear with me, it was difficult to distill a more minimal reproduction for this bug, it seems at a certain level of generics nesting the typechecker stops being able to deduce any further types and is stuck:
printPayload33(carriers.c33.val)
fails with:but so does
printPayload34(carriers.c34.val)
. At this point any furtherCarrier[Payload*[T]]
fields added to theCarrier
object are stuck atPayload32[system.int]
.Nim Version
Current Standard Output Logs
No response
Expected Standard Output Logs
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: