diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-04 22:04:09 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-13 21:47:51 -0800 |
commit | 066b1a1f5d80e1a314d6e96a9a8c0b4d76a8c7a1 (patch) | |
tree | 93cdc628540dc0d1192a82155668b0dba64b1b99 | |
parent | d7981e784e11e8a5a9a761f28d90725d721c9475 (diff) | |
download | scala-066b1a1f5d80e1a314d6e96a9a8c0b4d76a8c7a1.tar.gz scala-066b1a1f5d80e1a314d6e96a9a8c0b4d76a8c7a1.tar.bz2 scala-066b1a1f5d80e1a314d6e96a9a8c0b4d76a8c7a1.zip |
Fix for crasher in uncurry.
A small dose of packedType closes SI-4869.
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t4869.scala | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 4ae4042cc7..2e2ff23881 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -271,10 +271,14 @@ abstract class UnCurry extends InfoTransform def missingCaseCall(scrutinee: Tree): Tree = Apply(Select(This(anonClass), nme.missingCase), List(scrutinee)) def applyMethodDef() = { - val body = + val body = localTyper.typedPos(fun.pos) { if (isPartial) gen.mkUncheckedMatch(gen.withDefaultCase(fun.body, missingCaseCall)) else fun.body - DefDef(Modifiers(FINAL), nme.apply, Nil, List(fun.vparams), TypeTree(restpe), body) setSymbol applyMethod + } + // Have to repack the type to avoid mismatches when existentials + // appear in the result - see SI-4869. + val applyResultType = localTyper.packedType(body, applyMethod) + DefDef(Modifiers(FINAL), nme.apply, Nil, List(fun.vparams), TypeTree(applyResultType), body) setSymbol applyMethod } def isDefinedAtMethodDef() = { val isDefinedAtName = { diff --git a/test/files/pos/t4869.scala b/test/files/pos/t4869.scala new file mode 100644 index 0000000000..f84aa4ed07 --- /dev/null +++ b/test/files/pos/t4869.scala @@ -0,0 +1,8 @@ +// /scala/trac/4869/a.scala +// Wed Jan 4 21:17:29 PST 2012 + +class C[T] +class A { + def f[T](x: T): C[_ <: T] = null + def g = List(1d) map f +} |