summaryrefslogtreecommitdiff
path: root/test/files/pos/t6358.scala
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@gmail.com>2012-09-21 14:10:33 +0200
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2012-10-09 21:48:56 +0200
commit981424b376e8e66253c2ec863ca1222e41d8b374 (patch)
tree32b5a2839a775531223d6ca8faf2890110542c0a /test/files/pos/t6358.scala
parentc61c18e042d0fa41a09fea29a8dcaa2e08a40a63 (diff)
downloadscala-981424b376e8e66253c2ec863ca1222e41d8b374.tar.gz
scala-981424b376e8e66253c2ec863ca1222e41d8b374.tar.bz2
scala-981424b376e8e66253c2ec863ca1222e41d8b374.zip
Closes SI-6358. Move accessor generation for lazy vals to typers.
Until now lazy accessors were handled somehow special because their symbol was created in typers but the corresponding tree was only added in Refchecks. This irregularity caused serious problems for value classes. Also it now looks just better when lazy value is treated in a similar way as other fields. I needed to adapt reifier so that it handles the new implementation correctly. Previously it had to recreate lazy val only by removing defdef and renaming. Now we basically need to recreate lazy val from scratch. There is one minor change to cps plugin but that is still fine because lazy vals were never really part of the transformation. Some range positions needed to be fixed manually. We could do it at the creation time but that would require a lot more "if (symbol.isLazy)" conditions for MethodSyntheis and Symbol/Tree creation and would just unnecessary complicate api. If someone has a better idea, please speak up. Range positions changes were necessary because previously accessors were created at refchecks and they weren't checked by validator (even though they were wrong). This commit removes lazy val implementation restriction introduced for 2.10.0.
Diffstat (limited to 'test/files/pos/t6358.scala')
-rw-r--r--test/files/pos/t6358.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/files/pos/t6358.scala b/test/files/pos/t6358.scala
new file mode 100644
index 0000000000..25539c885e
--- /dev/null
+++ b/test/files/pos/t6358.scala
@@ -0,0 +1,6 @@
+class L(val t: Int) extends AnyVal {
+ def lazyString = {
+ lazy val x = t.toString
+ () => x
+ }
+}