-
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.
Merge pull request #11768 from dotty-staging/fix-11178
Fix #11178: remove unsound tweak for F-bounds in isInstanceOf check
- Loading branch information
Showing
8 changed files
with
92 additions
and
47 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
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,18 @@ | ||
object HTML: | ||
type AttrArg = AppliedAttr | Seq[AppliedAttr] | ||
opaque type AppliedAttr = String | ||
opaque type AppliedTag = StringBuilder | ||
|
||
case class Tag(name: String): | ||
def apply(attrs: AttrArg*): AppliedTag = { | ||
val sb = StringBuilder() | ||
sb.append(s"<$name") | ||
attrs.filter(_ != Nil).foreach{ | ||
case s: Seq[AppliedAttr] => | ||
s.foreach(sb.append(" ").append) | ||
case s: Seq[Int] => // error | ||
case e: AppliedAttr => | ||
sb.append(" ").append(e) | ||
} | ||
sb | ||
} |
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,39 @@ | ||
trait Box[+T] | ||
case class Foo[+S](s: S) extends Box[S] | ||
|
||
def unwrap2[A](b: Box[A]): A = | ||
b match | ||
case _: Foo[Int] => 0 // error | ||
|
||
object Test1 { | ||
// Invariant case, OK | ||
sealed trait Bar[A] | ||
|
||
def test[A](bar: Bar[A]) = | ||
bar match { | ||
case _: Bar[Boolean] => ??? // error | ||
case _ => ??? | ||
} | ||
} | ||
|
||
object Test2 { | ||
// Covariant case | ||
sealed trait Bar[+A] | ||
|
||
def test[A](bar: Bar[A]) = | ||
bar match { | ||
case _: Bar[Boolean] => ??? // error | ||
case _ => ??? | ||
} | ||
} | ||
|
||
object Test3 { | ||
// Contravariant case | ||
sealed trait Bar[-A] | ||
|
||
def test[A](bar: Bar[A]) = | ||
bar match { | ||
case _: Bar[Boolean] => ??? // error | ||
case _ => ??? | ||
} | ||
} |