diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-29 18:18:09 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-29 23:19:26 -0700 |
commit | 3904c3216c741b387d81754e55aa079ce4218d06 (patch) | |
tree | 9d53968a9542a5b2791afac33d6f8fa2152b66dd /src/compiler/scala/tools/nsc/ast/TreeGen.scala | |
parent | 62d97d7f110894a0c2f36b1ed9dd7ad59c0115fa (diff) | |
download | scala-3904c3216c741b387d81754e55aa079ce4218d06.tar.gz scala-3904c3216c741b387d81754e55aa079ce4218d06.tar.bz2 scala-3904c3216c741b387d81754e55aa079ce4218d06.zip |
LMF cannot instantiate SAM of trait with non-trait superclass
Also, drop AbstractFunction for parent of anonymous subclass of
function type that must have its class spun up at compile time
(rather than at linkage time by LambdaMetaFactory).
This revealed an old problem with typedTemplate, in which
parent types may be normalized at the level of trees,
while this change does not get propagated to the class's info
in time for the constructor to be located when we type check
the primary constructor.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeGen.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeGen.scala | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index 27e366e725..227d395036 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -310,13 +310,9 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL { newDefDef(methSym, moveToMethod(useMethodParams(fun.body)))(tpt = TypeTree(resTp)) } - // TODO: the rewrite to AbstractFunction is superfluous once we compile FunctionN to a SAM type (aka functional interface) - def functionClassType(fun: Function): Type = - if (isFunctionType(fun.tpe)) abstractFunctionType(fun.vparams.map(_.symbol.tpe), fun.body.tpe.deconst) - else fun.tpe def expandFunction(localTyper: analyzer.Typer)(fun: Function, inConstructorFlag: Long): Tree = { - val parents = addObjectParent(addSerializable(functionClassType(fun))) + val parents = addSerializable(fun.tpe) val anonClass = fun.symbol.owner newAnonymousFunctionClass(fun.pos, inConstructorFlag) addAnnotation SerialVersionUIDAnnotation // The original owner is used in the backend for the EnclosingMethod attribute. If fun is |