summaryrefslogtreecommitdiff
path: root/test/files/neg/compile-time-only-b.scala
blob: d5568dbe67baa428a79382c6cd24b0de8f1dd9cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
}