-
Notifications
You must be signed in to change notification settings - Fork 21
"illegal cyclic reference" again #11963
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
Comments
I was thrilled when I realized that Scala can encode family polymorphism that Java can not; It's been a year since Scala 2.13 broke this code. Multiple tickets that sound related to this issue had been opened; some were closed. This ticket was opened almost two months ago and did not see any activity since. I would really like to know: was this kind of code never legal, and family polymorphism encoding that I use only compiled (and run) prior to Scala 2.13 by mistake, or is there a bug in Scala 2.13.0, 2.13.1 and 2.13.2 compiler and Dotty compiler up to 0.26? If it is the former, I guess I need to start looking for alternatives; if it is the later, I'd like to have some idea about the timeline of the fix :) Since Scala type system is on solid foundation for the last 6 years, it shouldn't take somebody who is familiar with that foundation long to make the determination here. Do you think this can be arranged? Thanks! |
@odersky sorry to bother you directly, but I do not see any other way to find out if the 10-lines code snippet above is legal Scala... |
With illegal cyclic references the truth is basically what the compiler says. The compiler has an enormous amount of code and intelligence devoted to not getting it into infinite loops and stack-overflows, at least for the most part. The only argument would be to point out that a cyclic reference is not necessary since there is a reasonable way to avoid it. But the code given won't be legal Scala 3 anyway because of the S#Point construction (see the "type projections" part of the dotty reference). |
Thank you for a speedy reply!
So, what is legal with Scala 2.12 compiler is illegal with Scala 2.13 compiler, and both are correct?
Any pointers to the way to avoid such cyclic references?
That's what I expected, but Dotty 0.26 compiler did not complain about general type projection... Do you know of any examples, discussions or papers on family polymorphism encoding in Scala such that it:
Thanks! |
Yeah it's not disabled yet, it requires using |
Uh oh!
There was an error while loading. Please reload this page.
reproduction steps
problem
With Scala 2.13.0, 2.13.1 and 2.13.2:
expectation
like with Scala 2.12.10 :)
I do not understand if this is related to #11640 (or #11734) or is actually illegal in Scala 2.13 (and Dotty). I wasn't able to find a work-around :(
The text was updated successfully, but these errors were encountered: