Summoning covariant class leads to Nothing
in type argument
#17708
soronpo
started this conversation in
Feature Requests
Replies: 3 comments
-
I think this should be a feature request then. |
Beta Was this translation helpful? Give feedback.
0 replies
-
OK, I wasn't sure this isn't a bug. Tried to transfer it to lampepfl/dotty-feature-requests but I have no privileges to so. |
Beta Was this translation helpful? Give feedback.
0 replies
-
OK, I transferred it now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Removing covariance of
T
inFuzzy
results in successful compilation.Not sure that this is a bug, since this could be relevant to Scala's eager widening of non-invariant parameters, since Scala 2 has a similar issue.
Compiler version
v3.2.0-RC2
Minimized code
https://scastie.scala-lang.org/DB2gSGGzT5SLtkbSkskmNA
The following code fails similarly in Scala 2 (and succeeds when covariance is removed):
https://scastie.scala-lang.org/hRFQ9LLCQf2Jbxi9jRy76g
Output
Expectation
No error, if this is indeed a bug. If it's expected result from the widening mechanism, then we need a future language feature to specify the type argument must be precise/exact/narrow.
Beta Was this translation helpful? Give feedback.
All reactions