From 840ad7656456f014135c2a5e31e0d9ffd63625bd Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sat, 10 Aug 2013 14:52:24 +0200 Subject: marks Expr.splice and Expr.value with @compileTimeOnly Now that @compileTimeOnly is part of the standard library, why don't we use it within the standard library. --- test/files/neg/compile-time-only-b.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/files/neg/compile-time-only-b.scala (limited to 'test/files/neg/compile-time-only-b.scala') diff --git a/test/files/neg/compile-time-only-b.scala b/test/files/neg/compile-time-only-b.scala new file mode 100644 index 0000000000..d5568dbe67 --- /dev/null +++ b/test/files/neg/compile-time-only-b.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + // HAHA!!! + // no compileTimeOnly errors here, because scalac does constant folding + // the type of reify(42) is Expr[42.type] + // therefore the type of expr.splice is 42.type, which is then constfolded + val expr = reify(42) + val ignored1 = expr.splice + val ignored2 = expr.value + + val fortyTwo = 42 + val ignored3 = reify(fortyTwo).splice + val ignored4 = reify(fortyTwo).value +} \ No newline at end of file -- cgit v1.2.3