-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve the intersection of disjoint numbers in match analysis
The use of provablyDisjoint is a way of simplifying an intersection of two types into the Empty space, using type comparing logic. However, for types like (42L: Long) and (it: Int) (a constant type and a term ref, of two different number types) the two types are provably disjoint, but that doesn't mean that a "case `it` =>" won't match a "42L" scrutinee. So we extend the logic to keep the intersection as it is when numeric value types are in play.
- Loading branch information
Showing
2 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// scalac: -Werror | ||
@main def Test = | ||
val it: Int = 42 | ||
42L match | ||
case `it` => println("pass") | ||
case _ => println("fail") |