summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeGen.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-10 13:25:33 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-10 14:30:35 -0800
commit51f574ac9ff0dbcb665f48a8c1a380c59f2bb641 (patch)
treed0b31dfb0252b1af55e22acb2d854daf95dcdb51 /src/compiler/scala/tools/nsc/ast/TreeGen.scala
parente314ff1621ee26e1e4ec65abc6e360a7731bf488 (diff)
downloadscala-51f574ac9ff0dbcb665f48a8c1a380c59f2bb641.tar.gz
scala-51f574ac9ff0dbcb665f48a8c1a380c59f2bb641.tar.bz2
scala-51f574ac9ff0dbcb665f48a8c1a380c59f2bb641.zip
clean up synthesizePartialFunction
implement the following review comments by @retronym: - [x] Please clothe this naked assert. - [x] Use match to dissect targs and check isFullyDefined. - [x] Instead of `targs.head`/`targs.last`, use `val argTp :: resTp :: Nil = targs`. - [x] Add a quasi-quote-style comment for `apply`. - [x] Factor out mkCastPreservingAnnotations.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeGen.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 5cb43575b8..96146b7343 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -253,6 +253,11 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
}
}
+ // drop annotations generated by CPS plugin etc, since its annotationchecker rejects T @cps[U] <: Any
+ // let's assume for now annotations don't affect casts, drop them there, and bring them back using the outer Typed tree
+ def mkCastPreservingAnnotations(tree: Tree, pt: Type) =
+ Typed(mkCast(tree, pt.withoutAnnotations.dealias), TypeTree(pt))
+
/** Generate a cast for tree Tree representing Array with
* elem type elemtp to expected type pt.
*/