summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala8
2 files changed, 6 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index 74d654a267..9e1e14cf89 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -947,11 +947,13 @@ print()
*/
private def generalSwitchToTree(): Tree = {
this.exit = owner.newLabel(root.pos, "exit").setInfo(new MethodType(List(resultType), resultType));
- val result = exit.newValueParameter(root.pos, "result").setInfo( resultType );
+ //val result = exit.newValueParameter(root.pos, "result").setInfo( resultType );
+ val result = owner.newVariable(root.pos, "result").setInfo( resultType );
squeezedBlock(
List(
typedValDef(root.casted, selector),
- typed { toTree(root.and) },
+ typedValDef(result, EmptyTree /* defaultValue(result.tpe) */),
+ typed { toTree(root.and) },
ThrowMatchError(selector.pos, mkIdent(root.casted))) ,
LabelDef(exit, List(result), mkIdent(result)))
}
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 925f1e8e61..da5d83989c 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -299,12 +299,8 @@ abstract class LambdaLift extends InfoTransform {
}
private def proxyRef(sym: Symbol) = {
- if (sym.owner.isLabel) //
- gen.mkAttributedIdent(sym) // bq: account for the fact that LambdaLift does not know how to handle references to LabelDef parameters.
- else { //
- val psym = proxy(sym)
- if (psym.isLocal) gen.mkAttributedIdent(psym) else memberRef(psym)
- }
+ val psym = proxy(sym)
+ if (psym.isLocal) gen.mkAttributedIdent(psym) else memberRef(psym)
}
private def addFreeArgs(pos: Position, sym: Symbol, args: List[Tree]) = {