You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Better handle exactors
2. Translate the pattern `List(pat1, pat2, c:_*)` to space semantically
3. Deal with extractors that return `Some[_]`
Previously we approximate extractor either to the extracted type or Empty,
which is too coarse, and it causes some false positives about unreachable case.
Introducing the concept extractor into the theory enables us to inspect the
patterns inside extractors and check more unreachable cases, which is not
supported by Scalac.
Scalac is silent with following code, but Dotty reports both unexhaustive and
unreachable warnings.
sealed trait Node
case class NodeA(i: Int) extends Node
case class NodeB(b: Boolean) extends Node
case class NodeC(s: String) extends Node
object Node {
def unapply(node: Node): Option[(Node, Node)] = ???
}
object Test {
def foo(x: Node): Boolean = x match { // unexhaustive
case Node(NodeA(_), NodeB(_)) => true
case Node(NodeA(4), NodeB(false)) => true // unreachable code
}
}
1. Better handle exactors
2. Translate the pattern `List(pat1, pat2, c:_*)` to space semantically
3. Deal with extractors that return `Some[_]`
Previously we approximate extractor either to the extracted type or Empty,
which is too coarse, and it causes some false positives about unreachable case.
Introducing the concept extractor into the theory enables us to inspect the
patterns inside extractors and check more unreachable cases, which is not
supported by Scalac.
Scalac is silent with following code, but Dotty reports both unexhaustive and
unreachable warnings.
sealed trait Node
case class NodeA(i: Int) extends Node
case class NodeB(b: Boolean) extends Node
case class NodeC(s: String) extends Node
object Node {
def unapply(node: Node): Option[(Node, Node)] = ???
}
object Test {
def foo(x: Node): Boolean = x match { // unexhaustive
case Node(NodeA(_), NodeB(_)) => true
case Node(NodeA(4), NodeB(false)) => true // unreachable code
}
}
Dotty reports that in the following, one case is not reachable. Extractors should be better handled to avoid such annoying warnings.
The text was updated successfully, but these errors were encountered: