Skip to content

Commit 8f6f403

Browse files
committed
Merge pull request scala#3384 from adriaanm/merge-2.10.x
Merge 2.10.x
2 parents 0beca4b + 0d74502 commit 8f6f403

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

src/compiler/scala/tools/nsc/transform/UnCurry.scala

+7-5
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,13 @@ abstract class UnCurry extends InfoTransform
685685
case Packed(param, tempVal) => (param, tempVal)
686686
}.unzip
687687

688-
val rhs1 = localTyper.typedPos(rhs.pos) {
689-
// Patch the method body to refer to the temp vals
690-
val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
691-
// The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
692-
Block(tempVals, rhsSubstituted)
688+
val rhs1 = if (tempVals.isEmpty) rhs else {
689+
localTyper.typedPos(rhs.pos) {
690+
// Patch the method body to refer to the temp vals
691+
val rhsSubstituted = rhs.substituteSymbols(packedParams map (_.symbol), tempVals map (_.symbol))
692+
// The new method body: { val p$1 = p.asInstanceOf[<dependent type>]; ...; <rhsSubstituted> }
693+
Block(tempVals, rhsSubstituted)
694+
}
693695
}
694696

695697
(allParams :: Nil, rhs1)

test/files/pos/t8138.scala

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
class U {
3+
trait Transformer {
4+
def transform(a: Tree): Tree = ???
5+
}
6+
trait Tree
7+
}
8+
9+
object Test {
10+
def m(u: U) = {
11+
class C extends u.Transformer {
12+
override def transform(t: u.Tree): u.Tree = {
13+
null match {
14+
case _ =>
15+
// crashes in GenICode:
16+
// error: Unknown type: <notype>, <notype> [class scala.reflect.internal.Types$NoType$, class scala.reflect.internal.Types$NoType$] TypeRef? false
17+
(y: Any) => super.transform(???)
18+
null
19+
}
20+
???
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)