From 981424b376e8e66253c2ec863ca1222e41d8b374 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 21 Sep 2012 14:10:33 +0200 Subject: 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. --- test/files/continuations-neg/lazy.check | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'test/files/continuations-neg') diff --git a/test/files/continuations-neg/lazy.check b/test/files/continuations-neg/lazy.check index b8c6887409..3c460546be 100644 --- a/test/files/continuations-neg/lazy.check +++ b/test/files/continuations-neg/lazy.check @@ -1,6 +1,4 @@ -lazy.scala:5: error: type mismatch; - found : Unit @scala.util.continuations.cpsParam[Unit,Unit] - required: Unit - def foo() = { - ^ +lazy.scala:6: error: implementation restriction: cps annotations not allowed on lazy value definitions + lazy val x = shift((k:Unit=>Unit)=>k()) + ^ one error found -- cgit v1.2.3