diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-04 12:35:13 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-04 13:43:23 +0100 |
commit | 502818157671ff1d62264091b0102d05a42ff352 (patch) | |
tree | d24edb5dbe04348f26173503b6c359360582187a /test/files/run/idempotency-extractors.scala | |
parent | 2a8291a3568abc848e79acaacd82e90932a77c8a (diff) | |
download | scala-502818157671ff1d62264091b0102d05a42ff352.tar.gz scala-502818157671ff1d62264091b0102d05a42ff352.tar.bz2 scala-502818157671ff1d62264091b0102d05a42ff352.zip |
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.
Diffstat (limited to 'test/files/run/idempotency-extractors.scala')
-rw-r--r-- | test/files/run/idempotency-extractors.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/files/run/idempotency-extractors.scala b/test/files/run/idempotency-extractors.scala new file mode 100644 index 0000000000..fe033295f5 --- /dev/null +++ b/test/files/run/idempotency-extractors.scala @@ -0,0 +1,22 @@ +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 { + object Extractor { def unapply(x: Int): Option[Int] = Some(x) } + val extractor = reify { + 2 match { case Extractor(x) => x } + } + println(extractor.eval) + val tb = cm.mkToolBox() + val textractor = tb.typeCheck(extractor.tree) + println(textractor) + val rtextractor = tb.resetAllAttrs(textractor) + try { + println(tb.eval(rtextractor)) + } catch { + // this is the current behaviour, rather than the desired behavior; see SI-5465 + case _: ToolBoxError => println("error!") + } +}
\ No newline at end of file |