diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-02-14 21:59:43 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-02-14 23:08:38 +0100 |
commit | 97ec16850b152e6e03aba351cc918c66583362f3 (patch) | |
tree | 76be253e22192e9b093c4bb2dbaff6db7bb9ecce /test/pending/run/reify_timeofday.scala | |
parent | f6174691647bb1fae7e86d53790b1e540b890755 (diff) | |
download | scala-97ec16850b152e6e03aba351cc918c66583362f3.tar.gz scala-97ec16850b152e6e03aba351cc918c66583362f3.tar.bz2 scala-97ec16850b152e6e03aba351cc918c66583362f3.zip |
Disables typechecking that precedes reflective compilation
Previously toolboxes used to typecheck their inputs before compiling.
Actually, the initial demo by Martin first typechecked the reified tree,
then ran it, which typechecked it again, and only then launched the
reflective compiler.
However, as observed in https://issues.scala-lang.org/browse/SI-5464
current implementation of typechecking is not always idempotent.
That's why we cannot allow inputs of toolboxes to be typechecked,
at least not until the aforementioned issue is closed.
This is not only a convention but also a check inside compileExpr.
Diffstat (limited to 'test/pending/run/reify_timeofday.scala')
-rw-r--r-- | test/pending/run/reify_timeofday.scala | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/test/pending/run/reify_timeofday.scala b/test/pending/run/reify_timeofday.scala deleted file mode 100644 index 6bd11b0d30..0000000000 --- a/test/pending/run/reify_timeofday.scala +++ /dev/null @@ -1,48 +0,0 @@ -import scala.tools.nsc.reporters._ -import scala.tools.nsc.Settings -import reflect.runtime.Mirror.ToolBox - -object Test extends App { - val code = scala.reflect.Code.lift{ - class DateError extends Exception - - /** Simulating properties in Scala - * (example 4.2.1 in ScalaReference.pdf) - */ - class TimeOfDayVar { - private var h, m, s: Int = 0 - - def hours = h - - /** A method 'ident_=' is a setter for 'ident'. 'code.ident = ...' will - * be translated to a call to 'ident_=' - */ - def hours_= (h: Int) = - if (0 <= h && h < 24) this.h = h - else throw new DateError() - - def minutes = m - def minutes_= (m: Int) = - if (0 <= m && m < 60) this.m = m - else throw new DateError() - - def seconds = s - def seconds_= (s: Int) = - if (0 <= s && s < 60) this.s = s - else throw new DateError() - } - - val d = new TimeOfDayVar - d.hours = 8; d.minutes = 30; d.seconds = 0 - try { d.hours = 25 // throws a DateError exception - } catch { - case de: DateError => println("DateError") - case e: Exception => println("Exception") - } - }; - - val reporter = new ConsoleReporter(new Settings) - val toolbox = new ToolBox(reporter) - val ttree = toolbox.typeCheck(code.tree) - toolbox.runExpr(ttree) -} |