-
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 refineUsingParent to infer GADT bounds
Not doing so makes the type var interpolation between typer and the match space analysis different, which can result in false positive and negative exhaustivity and reachability warnings
- Loading branch information
Showing
4 changed files
with
37 additions
and
2 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
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,17 @@ | ||
// scalac: -Werror | ||
sealed abstract class Foo[A, B] | ||
final case class Bar[C](baz: C) extends Foo[C, C] | ||
|
||
class Test: | ||
def m1[X](f1: Foo[X, String]): String = f1 match { case Bar(_) => "" } // "" | ||
//def m2[X](f2: Foo[X, String]): X = f2 match { case Bar(x) => x } // x: X | ||
//def m3[X](f3: Foo[X, String]): String = f3 match { case Bar(x) => x } // x.asInstanceOf[x.type & String]: String | ||
//def m4[X](f4: Foo[X, String]): X = f4 match { case Bar(_) => "" } // "".asInstanceOf[("" & String & X) @uncheckedStable] | ||
|
||
// ptc: Bar[C] aka Foo[C, C] vs Foo[X, String] | ||
// ptc: C >: X ~> cstr: C >: X | ||
// ptc: C <: X ~> cstr: C := X | ||
// ptc: C >: String ~> gadt: X >: String | ||
// ptc: C <: String ~> gadt: X := String | ||
// ptc: Bar[X] | ||
// max: Bar[X] |