summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-11-06 23:26:38 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-11-06 23:26:38 +1000
commit000de44e3b1f1c0c4bc30eda8ef155548714a6af (patch)
tree5ee87dcffb91bcb5a375b3e8580f2238a5bd082c
parentced9e167d9d2c9016e76b6db94ceea7335d37bf2 (diff)
parentd6d8c06e02fa1e93e5dd37eeb08b2c1bb3805dd8 (diff)
downloadscala-000de44e3b1f1c0c4bc30eda8ef155548714a6af.tar.gz
scala-000de44e3b1f1c0c4bc30eda8ef155548714a6af.tar.bz2
scala-000de44e3b1f1c0c4bc30eda8ef155548714a6af.zip
Merge pull request #4094 from retronym/ticket/8962
SI-8962 Fix regression with skolems in pattern translation
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala4
-rw-r--r--test/files/pos/t8962.scala31
2 files changed, 34 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index eb29ccf4e1..e278130437 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -330,7 +330,7 @@ trait Contexts { self: Analyzer =>
// if set, errors will not be reporter/thrown
def bufferErrors = reporter.isBuffering
- def reportErrors = !bufferErrors
+ def reportErrors = !(bufferErrors || reporter.isThrowing)
// whether to *report* (which is separate from buffering/throwing) ambiguity errors
def ambiguousErrors = this(AmbiguousErrors)
@@ -1247,6 +1247,7 @@ trait Contexts { self: Analyzer =>
def makeImmediate: ContextReporter = this
def makeBuffering: ContextReporter = this
def isBuffering: Boolean = false
+ def isThrowing: Boolean = false
/** Emit an ambiguous error according to context.ambiguousErrors
*
@@ -1384,6 +1385,7 @@ trait Contexts { self: Analyzer =>
* TODO: get rid of it, use ImmediateReporter and a check for reporter.hasErrors where necessary
*/
private[typechecker] class ThrowingReporter extends ContextReporter {
+ override def isThrowing = true
protected def handleError(pos: Position, msg: String): Unit = throw new TypeError(pos, msg)
}
diff --git a/test/files/pos/t8962.scala b/test/files/pos/t8962.scala
new file mode 100644
index 0000000000..4331c154ba
--- /dev/null
+++ b/test/files/pos/t8962.scala
@@ -0,0 +1,31 @@
+package test.nestedcov
+
+sealed abstract class Outer[+A]
+case class Let[+A](expr: Outer[Inner[A]]) extends Outer[A]
+
+sealed abstract class Inner[+A]
+
+sealed abstract class Outer2[+A, +B]
+case class Let2[+A](expr: Outer2[Inner2[A], A]) extends Outer2[A, A]
+
+sealed abstract class Inner2[+A]
+
+sealed abstract class Outer3[+A, +B]
+case class Let3[+A](expr: Outer3[A, A]) extends Outer3[A, A]
+
+object NestedCov {
+ def run[A](nc: Outer[A]) = nc match {
+ case Let(expr) =>
+ expr : Outer[Inner[A]]
+ }
+
+ def run2[A](nc: Outer2[A, A]) = nc match {
+ case Let2(expr) =>
+ expr : Outer2[Inner2[A], A]
+ }
+
+ def run3[A](nc: Outer3[A, A]) = nc match {
+ case Let3(expr) =>
+ expr : Outer3[A, A]
+ }
+}