-
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.
and eliminate super traits in widenInferred
- Loading branch information
Showing
18 changed files
with
124 additions
and
44 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
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,10 @@ | ||
package scala.runtime | ||
|
||
super trait EnumValue extends Product, Serializable: | ||
override def canEqual(that: Any) = this eq that.asInstanceOf[AnyRef] | ||
override def productArity: Int = 0 | ||
override def productPrefix: String = toString | ||
override def productElement(n: Int): Any = | ||
throw IndexOutOfBoundsException(n.toString) | ||
override def productElementName(n: Int): String = | ||
throw IndexOutOfBoundsException(n.toString) |
File renamed without changes.
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,32 @@ | ||
sealed super trait TA | ||
sealed super trait TB | ||
case object a extends TA, TB | ||
case object b extends TA, TB | ||
|
||
object Test: | ||
|
||
def choose0[X](x: X, y: X): X = x | ||
def choose1[X <: TA](x: X, y: X): X = x | ||
def choose2[X <: TB](x: X, y: X): X = x | ||
def choose3[X <: Product](x: X, y: X): X = x | ||
def choose4[X <: TA & TB](x: X, y: X): X = x | ||
|
||
choose0(a, b) match | ||
case _: TA => ??? | ||
case _: TB => ??? | ||
|
||
choose1(a, b) match | ||
case _: TA => ??? | ||
case _: TB => ??? // error: unreachable | ||
|
||
choose2(a, b) match | ||
case _: TB => ??? | ||
case _: TA => ??? // error: unreachable | ||
|
||
choose3(a, b) match | ||
case _: Product => ??? | ||
case _: TA => ??? // error: unreachable | ||
|
||
choose4(a, b) match | ||
case _: (TA & TB) => ??? | ||
case _: Product => ??? // error: unreachable |
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,13 @@ | ||
super trait S | ||
trait A | ||
class B extends A, S | ||
class C extends A, S | ||
|
||
val x = if ??? then B() else C() | ||
val x1: S = x // error | ||
|
||
case object a | ||
case object b | ||
val y = if ??? then a else b | ||
val y1: Product = y // error | ||
val y2: Serializable = y // error |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val a = new A_1 | ||
val x = new java.io.Serializable {} | ||
val x: java.io.Serializable = new java.io.Serializable {} | ||
a.foo(x) | ||
} | ||
} |