summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-04-05 12:44:29 -0700
committerPaul Phillips <paulp@improving.org>2012-04-05 13:19:34 -0700
commit62acd249052f889e9519213fa91bcf212429bc8e (patch)
tree68ac1888f2bf52aa7a48ef7c1cbe9d53ff5128c7
parent37eabf615afe3de9733ea41cc9c522df3e2a6b87 (diff)
downloadscala-62acd249052f889e9519213fa91bcf212429bc8e.tar.gz
scala-62acd249052f889e9519213fa91bcf212429bc8e.tar.bz2
scala-62acd249052f889e9519213fa91bcf212429bc8e.zip
Fix for continuations issue with match blocks.
Don't type pattern trees with annotations still attached.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
-rw-r--r--test/files/continuations-run/z1673.check0
-rw-r--r--test/files/continuations-run/z1673.scala31
3 files changed, 35 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 09fb39125e..36c81b09cd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2089,7 +2089,10 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
for (Apply(_, xs) <- cdef.pat ; x <- xs dropRight 1 ; if treeInfo isStar x)
StarPositionInPatternError(x)
- val pat1 = typedPattern(cdef.pat, pattpe)
+ // withoutAnnotations - see continuations-run/z1673.scala
+ // This adjustment is awfully specific to continuations, but AFAICS the
+ // whole AnnotationChecker framework is.
+ val pat1 = typedPattern(cdef.pat, pattpe.withoutAnnotations)
// When case classes have more than two parameter lists, the pattern ends
// up typed as a method. We only pattern match on the first parameter
// list, so substitute the final result type of the method, i.e. the type
diff --git a/test/files/continuations-run/z1673.check b/test/files/continuations-run/z1673.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/continuations-run/z1673.check
diff --git a/test/files/continuations-run/z1673.scala b/test/files/continuations-run/z1673.scala
new file mode 100644
index 0000000000..716b374860
--- /dev/null
+++ b/test/files/continuations-run/z1673.scala
@@ -0,0 +1,31 @@
+import scala.util.continuations._
+
+class MatchRepro {
+ def s: String @cps[Any] = shift { k => k("foo") }
+
+ def p = {
+ val k = s
+ s match { case lit0 => }
+ }
+
+ def q = {
+ val k = s
+ k match { case lit1 => }
+ }
+
+ def r = {
+ s match { case "FOO" => }
+ }
+
+ def t = {
+ val k = s
+ k match { case "FOO" => }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val m = new MatchRepro
+ ()
+ }
+}