aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/ast/tpd.scala2
-rw-r--r--test/test/transform/LazyValsTest.scala9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala
index 173f81894..b549080e4 100644
--- a/src/dotty/tools/dotc/ast/tpd.scala
+++ b/src/dotty/tools/dotc/ast/tpd.scala
@@ -272,7 +272,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
*
* gets expanded to
*
- * <module> lazy val obj = new obj$
+ * <module> val obj = new obj$
* <module> class obj$ extends parents { this: obj.type => decls }
*
* (The following no longer applies:
diff --git a/test/test/transform/LazyValsTest.scala b/test/test/transform/LazyValsTest.scala
index edcc7ce0c..6e44f3b15 100644
--- a/test/test/transform/LazyValsTest.scala
+++ b/test/test/transform/LazyValsTest.scala
@@ -7,6 +7,15 @@ import org.junit.Assert
class LazyValsTest extends DottyTest {
@Test
+ def doNotRewriteObjects = {
+ checkCompile("LazyVals", "object O"){ (tree, ctx) =>
+ Assert.assertTrue("local lazy shouldn't rewrite module instance definitions", tree.toString.contains(
+ "ValDef(Modifiers(final module <stable>,,List()),O,Ident(O$),Apply(Select(New(Ident(O$)),<init>),List()))"
+ ))
+ }
+ }
+
+ @Test
def localInt = {
checkCompile("LazyVals", "class LocalLV { def m = { lazy val s = 1; s }}"){ (tree, ctx) =>
Assert.assertTrue("local lazy int rewritten to class creation", tree.toString.contains(