-
Notifications
You must be signed in to change notification settings - Fork 3.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 #3523 from adriaanm/rebase-3514
Fix pattern inference regression
- Loading branch information
Showing
10 changed files
with
46 additions
and
17 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
t4818.scala:4: error: type mismatch; | ||
found : Int(5) | ||
required: A | ||
required: Nothing | ||
def f(x: Any) = x match { case Fn(f) => f(5) } | ||
^ | ||
one error found |
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 @@ | ||
-Xstrict-inference |
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 was deleted.
Oops, something went wrong.
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,9 @@ | ||
case class Transition[S](x: S) | ||
|
||
object C | ||
|
||
object Test { | ||
(??? : Any) match { | ||
case Transition(C) => | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
trait Covariant[+A] | ||
trait Contra[-A] { def accept(p: A): Unit } | ||
trait Invariant[A] extends Covariant[A] with Contra[A] | ||
|
||
trait T | ||
case class Unravel[A](m: Contra[A], msg: A) extends T | ||
|
||
object Test extends Covariant[Any] { | ||
def g(m: Contra[Any]): Unit = m accept 5 | ||
def f(x: T): Unit = x match { | ||
case Unravel(m, msg) => g(m) | ||
case _ => | ||
} | ||
def main(args: Array[String]) { | ||
f(Unravel[String](new Contra[String] { def accept(x: String) = x.length }, "")) | ||
} | ||
} | ||
// java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String | ||
// at Test$$anon$1.accept(a.scala:18) | ||
// at Test$.g(a.scala:13) | ||
// at Test$.f(a.scala:15) | ||
// at Test$.main(a.scala:18) | ||
// at Test.main(a.scala) |
File renamed without changes.