-
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.
Allow constraining a parameter to Nothing (#19397)
Fixes #19359
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
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,23 @@ | ||
sealed trait Plan[+E <: Err, +F[+e <: E] <: Fal[e]] | ||
|
||
case class Err() extends Plan[Err, Nothing] | ||
case class Fal[+E <: Err]() extends Plan[E, Fal] | ||
case class Btw[+E <: Err, +F[+e <: E] <: Fal[e]]() extends Plan[E, F] | ||
|
||
class Tests: | ||
def test1(plan: Plan[Err, Nothing]): Unit = plan match | ||
case Err() => | ||
case Btw() => | ||
|
||
def main1 = test1(Btw()) | ||
|
||
/* | ||
Previously, Plan[Err, Nothing] dropped Btw, | ||
because it didn't instantiate ?F to Nothing | ||
<== decompose(Plan[Err, Nothing], [Btw[Err, Fal]]) = [Not, Err] | ||
<== decompose(Btw[Err, Fal] & Plan[Err, Nothing]) = [] | ||
<== simplify(Prod(Btw())) = Empty | ||
*/ |