Skip to content

Commit

Permalink
Fix for crasher in uncurry.
Browse files Browse the repository at this point in the history
A small dose of packedType closes SI-4869.
  • Loading branch information
paulp committed Jan 14, 2012
1 parent d7981e7 commit 066b1a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/compiler/scala/tools/nsc/transform/UnCurry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
8 changes: 8 additions & 0 deletions test/files/pos/t4869.scala
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 066b1a1

Please sign in to comment.