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
Scala 2.12 incorrectly assumes invariance #12821
Comments
When something is fixed in 2.13, we don't keep the ticket open. So I'm closing, but note regardless that:
Despite our best intentions, closing a ticket is sometimes taken as a slap in the face, as we saw on e.g. #11259. I assure you that's not our intention. |
Not sure what 2.13.2 PR fixed this, but the "Compiler fixes" section of https://github.com/scala/scala/releases/tag/v2.13.2 has a couple of obvious candidates |
My face is positively unslapped 🙂 |
Do I understand correctly that you verified that it fails on 2.13.1 and not 2.13.2? In which case, I might try and backport it myself some time in the distant future |
yeah. scala-cli is great for this sort of testing ( |
Awesome. I assume I can |
Every merged PR has a corresponding nightly build, not on Maven Central, but on https://scala-ci.typesafe.com/artifactory/scala-integration/ — where scala-cli will look by default if you ask for a version number such as |
Ok amazing, thanks ❤️ Hopefully when I'm free of my PhD restraints I can try and hunt this down! |
are you getting a PhD or a BD? |
Definitely PhD @som-snytt 😛 |
Reproduction steps
Scala version: 2.12.18
Problem
In Scala 2.13.11 and Scala 3.3.0, this code compiles entirely fine. In Scala 2.12 however, it reports the following errors:
Both of these are incorrectly assuming the variance is mismatched, but this is not the case, and adding a covariance annotation as in
InvKCo
does not help either.There is a workaround, which is to use
@uncheckedVariance
.(thanks @s5bug for the minimisation 🙂)
The text was updated successfully, but these errors were encountered: