summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-01-19 11:27:55 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-01-19 11:27:55 -0800
commit8f6f4032b5c026fd9301cebe28dde5bb7c8e264c (patch)
tree717befc6a81467fe5837ef59696c915baff69659
parent0beca4b2f039fb21222cef29c1b7b5a012df5e61 (diff)
parent0d74502ce5657c8b64575dac1663a24d287ecb0d (diff)
downloadscala-2.11.0-M8.tar.gz
scala-2.11.0-M8.tar.bz2
scala-2.11.0-M8.zip
Merge pull request #3384 from adriaanm/merge-2.10.xv2.11.0-M8
Merge 2.10.x
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala12
-rw-r--r--test/files/pos/t8138.scala24
2 files changed, 31 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index ef50ae276f..e193cf3de2 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -685,11 +685,13 @@ abstract class UnCurry extends InfoTransform
case Packed(param, tempVal) => (param, tempVal)
}.unzip
- val rhs1 = localTyper.typedPos(rhs.pos) {
- // Patch the method body to refer to the temp vals
- val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
- // The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
- Block(tempVals, rhsSubstituted)
+ val rhs1 = if (tempVals.isEmpty) rhs else {
+ localTyper.typedPos(rhs.pos) {
+ // Patch the method body to refer to the temp vals
+ val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
+ // The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
+ Block(tempVals, rhsSubstituted)
+ }
}
(allParams :: Nil, rhs1)
diff --git a/test/files/pos/t8138.scala b/test/files/pos/t8138.scala
new file mode 100644
index 0000000000..b980930955
--- /dev/null
+++ b/test/files/pos/t8138.scala
@@ -0,0 +1,24 @@
+
+class U {
+ trait Transformer {
+ def transform(a: Tree): Tree = ???
+ }
+ trait Tree
+}
+
+object Test {
+ def m(u: U) = {
+ class C extends u.Transformer {
+ override def transform(t: u.Tree): u.Tree = {
+ null match {
+ case _ =>
+ // crashes in GenICode:
+ // error: Unknown type: <notype>, <notype> [class scala.reflect.internal.Types$NoType$, class scala.reflect.internal.Types$NoType$] TypeRef? false
+ (y: Any) => super.transform(???)
+ null
+ }
+ ???
+ }
+ }
+ }
+}