summaryrefslogtreecommitdiff
path: root/test/files/run/idempotency-partial-functions.scala
blob: dd5f1167f1431a805fa1f202e6cf977906b2a78e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 partials = reify {
    List((false,true)) collect { case (x,true) => x }
  }
  try {
    println(partials.eval)
  } catch {
    case _: ToolBoxError => println("error!!")
  }
  try {
    val tb = cm.mkToolBox()
    val tpartials = tb.typeCheck(partials.tree)
    println(tpartials)
    val rtpartials = tb.resetAllAttrs(tpartials)
    println(tb.eval(rtpartials))
  } catch {
    // this is the current behaviour, rather than the desired behavior; see SI-6187
    case _: ToolBoxError => println("error!")
  }
}