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
Problems with polymorphic method, Nothing, Invariant return type #1570
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1570?orig=1 |
Mohsen Lesani [X] (lesani) said: This is still a problem in Trunk. |
@soc said: scala> f(x)
<console>:9: error: type mismatch;
found : Test[Nothing]
required: Test[A]
Note: Nothing <: A, but trait Test is invariant in type A.
You may wish to define A as +A instead. (SLS 4.5)
f(x)
^ |
Daniel Darabos (darabos) said: |
Guys, should we try to adopt that as a quick-and-dirty fix for this? |
This comment has been minimized.
This comment has been minimized.
@SethTisue You must have done something weird in your repl session, I just tried it and all these examples typecheck in Dotty 0.27.0-RC1: https://scastie.scala-lang.org/smarter/aTB7lTdPTVa7wSI5dEW4wA/5 |
Happening in Scala 2.7.1 and 2.7.2 at least:
This happens only for A=Nothing. And only if the return type is invariant in a type variable being Nothing. There is probably not much sense in operating on Nothing types, but what is the rationale behind this behaviour?
The text was updated successfully, but these errors were encountered: