-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Invariant opaque type refinement loss across external dependency #12945
Comments
(Dale and I briefly wondered if |
I updated the title to reflect this is an opaque type issue |
Another issue with separate compilation of opaque types: #13001 |
It would be good to narrow the original example down a bit. Also, it would be good to see if it can be expressed in terms of separate compilation – using |
@anatoliykmetyuk I further minimized the example. See updated OP.
|
Looks good! |
Edit:
I managed to further minimize the example.
It seems that type inference behaves differently across test dependency and fails to reduce (possibly any kind of different module dependency is affected).
Compiler version
v3.0.1-RC2 (also checked on nightly 3.0.2-RC1-bin-20210624-ecbe3d2-NIGHTLY)
Minimized code
Minimized project at: https://github.com/soronpo/dottybug/tree/invariance_widen_err
Main.scala
Test.scala //must be placed at scala/test
Output
Expectation
No error. Notice the same expression works within the main module and fails within the test module.
Note
Opaque types seem to be part of the problem, since if we change
Lie
to a trait the error goes away.The contravariance in
Lie.TC
is also crucial for the error, but it should not cause widening becauseLie
is invariant.The text was updated successfully, but these errors were encountered: