-
Notifications
You must be signed in to change notification settings - Fork 21
Type mismatch under -Xsource:3
with inferred overridden types
#12707
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
This is zio 1.0.17. It's helpful to provide a minimal build (or scala-cli header). The example needs an Dotty says
If it is agreed that this is correct behavior, then The type inferred from RHS was The reason to prefer to infer the overridden type was that the RHS (as a co-variant subtype) is too constraining, such as an |
Further questions about contravariance and override: |
a meta-issue here is that we don't have good documentation for |
add an example from scala/bug#12707
For anyone happening to land on this ticket, note that as of 2.13.13 the behavior change with inferred return types on overrides no longer occurs under |
Reproduction steps
A recent change in Scala 2.13.9 (#9891) caused a lot of compilation errors in our code base that was previously compiling. We're using ZIO, and heavily rely on type inference, so most of our codebase omits type signatures. The following snippet is compiles fine in Scala 2.13 with
-Xsource:3
before 2.13.9:Causing the following mismatch:
I understand the nature of the change, but I would like a workaround that does not require me to change hundreds of type signatures... Please advise.
The text was updated successfully, but these errors were encountered: