From 502818157671ff1d62264091b0102d05a42ff352 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 4 Dec 2012 12:35:13 +0100 Subject: tests for idempotency issues in the typechecker For more details see https://issues.scala-lang.org/browse/SI-5464. Check files are intentionally very precise, so that we can monitor how the situation changes over time. --- test/files/run/idempotency-lazy-vals.scala | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/files/run/idempotency-lazy-vals.scala (limited to 'test/files/run/idempotency-lazy-vals.scala') diff --git a/test/files/run/idempotency-lazy-vals.scala b/test/files/run/idempotency-lazy-vals.scala new file mode 100644 index 0000000000..3531f9ff4b --- /dev/null +++ b/test/files/run/idempotency-lazy-vals.scala @@ -0,0 +1,27 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import scala.tools.reflect.Eval + +object Test extends App { + val lazee = reify { + class C { + lazy val x = 2 + implicit lazy val y = 3 + } + val c = new C() + import c._ + x * implicitly[Int] + } + println(lazee.eval) + val tb = cm.mkToolBox() + val tlazee = tb.typeCheck(lazee.tree) + println(tlazee) + val rtlazee = tb.resetAllAttrs(tlazee) + try { + println(tb.eval(rtlazee)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5466 + case _: ToolBoxError => println("error!") + } +} \ No newline at end of file -- cgit v1.2.3