We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
otavia-projects/otavia
-Yexplicit-nulls
Code no longer compiles when -Yexplicit-nulls is used. Based on Open CB failure of otavia-projects/otavia - build logs
3.4.0
Last good release: 3.3.2-RC1-bin-20230605-348729e-NIGHTLY First bad release: 3.3.2-RC1-bin-20230606-5d2812a-NIGHTLY Bisect points to 3e1fbd6
//> using options -Yexplicit-nulls sealed trait Message extends Serializable type MessageOf[A <: Actor[?]] <: Call = A match { case Actor[m] => m } sealed trait Call extends Message trait Ask[R <: Reply] extends Call type ReplyOf[A <: Ask[? <: Reply]] <: Reply = A match case Ask[r] => r trait Reply extends Message sealed trait UnitReply private () extends Reply trait Future[+V] sealed trait MessageFuture[+R <: Reply] extends Future[R] trait Actor[+M <: Call] trait Address[-M <: Call]: // extends EventableAddress { def send[A <: M & Ask[? <: Reply]](send: A): Unit def ask[A <: M & Ask[? <: Reply]](ask: A, future: MessageFuture[ReplyOf[A]]): MessageFuture[ReplyOf[A]] final case class AcceptedChannel() extends Ask[UnitReply] abstract class AcceptedWorkerActor[M <: Call] extends Actor[M | AcceptedChannel] abstract class AcceptorActor[W <: AcceptedWorkerActor[? <: Call]]{ private var workers: Address[MessageOf[W]] = ??? def future: MessageFuture[UnitReply] = ??? def case1 = workers.send(AcceptedChannel()) // error def case2 = workers.ask(AcceptedChannel(), future) // error }
Compiling project (Scala 3.4.0, JVM (17)) [error] ./bisect/main.scala:32:30 [error] Found: AcceptedChannel [error] Required: MessageOf[W] & Ask[? <: Reply] [error] def case1 = workers.send(AcceptedChannel()) // error [error] ^^^^^^^^^^^^^^^^^ [error] ./bisect/main.scala:33:29 [error] Found: AcceptedChannel [error] Required: MessageOf[W] & Ask[? <: Reply] [error] def case2 = workers.ask(AcceptedChannel(), future) // error [error] ^^^^^^^^^^^^^^^^^ [error] ./bisect/main.scala:33:48 [error] Found: MessageFuture[UnitReply] [error] Required: MessageFuture[ReplyOf[A]] [error] [error] where: A is a type variable with constraint <: MessageOf[W] & Ask[? <: Reply] [error] [error] [error] Note: a match type could not be fully reduced: [error] [error] trying to reduce ReplyOf[A] [error] failed since selector W [error] does not uniquely determine parameter m in [error] case Actor[m] => m [error] The computed bounds for the parameter are: [error] m <: Call | AcceptedChannel [error] def case2 = workers.ask(AcceptedChannel(), future) // error [error] ^^^^^^ Error compiling project (Scala 3.4.0, JVM (17))
Should probably compile
The text was updated successfully, but these errors were encountered:
-Yexplicit-nulls is unstable, so code might break. @noti0na1 should take a look.
Sorry, something went wrong.
The minimized code produces the same errors with and without explicit nulls, so I don't think it relates to null safety.
After looking at the tests in #17180, I guess the errors are expected?
Could you confirm the expected behaviour? @odersky @sjrd
Oh yes that's expected. In terms of SIP-56 this was made more precise. See occurrences of "concrete type" and in particular the step
If scrutIsWidenedAbstract is true, fail as not specific.
scrutIsWidenedAbstract
true
at https://docs.scala-lang.org/sips/match-types-spec.html#matching
sjrd
No branches or pull requests
Code no longer compiles when
-Yexplicit-nulls
is used.Based on Open CB failure of
otavia-projects/otavia
- build logsCompiler version
3.4.0
Last good release: 3.3.2-RC1-bin-20230605-348729e-NIGHTLY
First bad release: 3.3.2-RC1-bin-20230606-5d2812a-NIGHTLY
Bisect points to 3e1fbd6
Minimized code
Output
Expectation
Should probably compile
The text was updated successfully, but these errors were encountered: