summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-25 12:46:01 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-25 12:46:01 -0800
commit2fa859e1b3eb2ac57058feaba87d96adfbac9209 (patch)
treea3e84beacb7aa543ab0eda70eaa305d7952fc3b0
parent3753efc060af39d9247273cdc8da74ce57f627c5 (diff)
parentd592216a12d8bd145f6a670554e9217944c2b169 (diff)
downloadscala-2fa859e1b3eb2ac57058feaba87d96adfbac9209.tar.gz
scala-2fa859e1b3eb2ac57058feaba87d96adfbac9209.tar.bz2
scala-2fa859e1b3eb2ac57058feaba87d96adfbac9209.zip
Merge pull request #1956 from JamesIry/SI-7011_2.10.x
SI-7011 Fix finding constructor type in captured var definitions
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala4
-rw-r--r--test/files/pos/t7011.flags1
-rw-r--r--test/files/pos/t7011.scala7
3 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 952ca96f54..448079abed 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -443,10 +443,10 @@ abstract class LambdaLift extends InfoTransform {
/* Creating a constructor argument if one isn't present. */
val constructorArg = rhs match {
case EmptyTree =>
- sym.primaryConstructor.info.paramTypes match {
+ sym.tpe.typeSymbol.primaryConstructor.info.paramTypes match {
case List(tp) => gen.mkZero(tp)
case _ =>
- log("Couldn't determine how to properly construct " + sym)
+ debugwarn("Couldn't determine how to properly construct " + sym)
rhs
}
case arg => arg
diff --git a/test/files/pos/t7011.flags b/test/files/pos/t7011.flags
new file mode 100644
index 0000000000..a4c161553e
--- /dev/null
+++ b/test/files/pos/t7011.flags
@@ -0,0 +1 @@
+-Ydebug -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t7011.scala b/test/files/pos/t7011.scala
new file mode 100644
index 0000000000..539f662bc0
--- /dev/null
+++ b/test/files/pos/t7011.scala
@@ -0,0 +1,7 @@
+object bar {
+ def foo {
+ lazy val x = 42
+
+ {()=>x}
+ }
+} \ No newline at end of file