diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-27 13:31:06 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-02-07 15:02:46 -0800 |
commit | dfbaaa179fddd3d37abf66a08080f646b8557b6f (patch) | |
tree | ac90ee932e1d20ab83cc031feb049945be398c2b /test/files/run/idempotency-partial-functions.scala | |
parent | 0dd02d92a363ee13b13eb4536c938d24bb5dd98d (diff) | |
download | scala-dfbaaa179fddd3d37abf66a08080f646b8557b6f.tar.gz scala-dfbaaa179fddd3d37abf66a08080f646b8557b6f.tar.bz2 scala-dfbaaa179fddd3d37abf66a08080f646b8557b6f.zip |
SI-6187 Make partial functions re-typable
- `New(tpe)` doesn't survive a `resetAttrs` / typecheck; use
a name instead.
- Abandon the tree attachment that passed the default
case from `typer` to `patmat`; this tree eluded the
attribute reset performed in the macro. Instead, add it
to the match. Apart from making the tree re-typable, it
also exposes the true code structure to macros, which
is important if they need to perform other code
transformations.
- Install original trees on the declared types of the
parameters of the `applyOrElse` method to ensure that
references to them within the method pick up the correct
type parameter skolems upon retypechecking.
- Propagate `TypeTree#original` through `copyAttrs`,
which is called during tree duplication / `TreeCopiers`.
Without this, the original trees that we installed were
not visible anymore during `ResetAttrs`.
We are not able to reify partial functions yet -- the
particular sticking point is reification of the parentage
which is only available in the `ClassInfoType`.
Diffstat (limited to 'test/files/run/idempotency-partial-functions.scala')
-rw-r--r-- | test/files/run/idempotency-partial-functions.scala | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/test/files/run/idempotency-partial-functions.scala b/test/files/run/idempotency-partial-functions.scala deleted file mode 100644 index dd5f1167f1..0000000000 --- a/test/files/run/idempotency-partial-functions.scala +++ /dev/null @@ -1,25 +0,0 @@ -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!") - } -}
\ No newline at end of file |