-
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.
Rollback constraints in compareAppliedTypeParamRef (#22339)
This PR adds a `rollbackConstraintsUnless` in `compareAppliedTypeParamRef`. It is required in case the call to `directionalIsSubType` introduces constraints and the call to `directionalRecur` returns `false`. Fixes #20519
- Loading branch information
Showing
4 changed files
with
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Box[T](val value: T) | ||
|
||
def boo[F[_], A](e: F[Box[A]]): F[A] = ??? | ||
|
||
type Result[G[_], B] = G[Box[B]] | ||
|
||
def main = | ||
val b: Result[Option, Int] = ??? | ||
val c = boo(b) | ||
c: Option[Int] |
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,16 @@ | ||
trait TCl[F[_]] | ||
|
||
def boo[F[_], A](e: F[Option[A]], ev: TCl[F]): Unit = () | ||
|
||
type Result[F[_], A] = F[Option[A]] | ||
|
||
@main def main = | ||
summon[Result[Option, Int] =:= Option[Option[Int]]] | ||
|
||
val ev = new TCl[Option] {} | ||
|
||
val b: Result[Option, Int] = None | ||
boo(b, ev) | ||
|
||
val b2: Option[Option[Int]] = None | ||
boo(b2, ev) |
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,20 @@ | ||
object Main { | ||
trait TCl[F[_]] | ||
|
||
implicit class Stx[F[_], A](e: F[Option[A]]) { | ||
def boo(implicit ev: TCl[F]): Unit = () | ||
} | ||
|
||
type Result[F[_], A] = F[Option[A]] | ||
|
||
implicit val t: TCl[Option] = new TCl[Option] {} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val b: Result[Option, Int] = None | ||
b.boo | ||
|
||
// works without the alias: | ||
val b2: Option[Option[Int]] = None | ||
b2.boo | ||
} | ||
} |