summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api
diff options
context:
space:
mode:
authorDenys Shabalin <denys.shabalin@typesafe.com>2014-03-22 13:14:37 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-03-25 20:16:52 +0100
commit0bac64d64309e2f236ba25d8e57b1ea1f62d4d8c (patch)
treece121f4a26af1a6ea84248770b4bf7b92a7a58cc /src/reflect/scala/reflect/api
parentc765537cb3532a7b88f1b68331840953f3e9d048 (diff)
downloadscala-0bac64d64309e2f236ba25d8e57b1ea1f62d4d8c.tar.gz
scala-0bac64d64309e2f236ba25d8e57b1ea1f62d4d8c.tar.bz2
scala-0bac64d64309e2f236ba25d8e57b1ea1f62d4d8c.zip
SI-8388 consistently match type trees by originals
Due to the fact that all TypTrees are transformed into TypeTrees during typechecking one couldn't treat typed type trees in the same way as they treat untyped type trees. This change implements support for pattern matching of TypeTrees as their corresponding TypTree equivalent using tree preserved in the original. The implementation itself is a trivial wrapping of regular TypTree extractors into MaybeTypeTreeOriginal.
Diffstat (limited to 'src/reflect/scala/reflect/api')
-rw-r--r--src/reflect/scala/reflect/api/Internals.scala44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/api/Internals.scala b/src/reflect/scala/reflect/api/Internals.scala
index 7788dba63e..577cd09295 100644
--- a/src/reflect/scala/reflect/api/Internals.scala
+++ b/src/reflect/scala/reflect/api/Internals.scala
@@ -780,10 +780,16 @@ trait Internals { self: Universe =>
def unapply(tree: Try): Option[(Tree, List[CaseDef], Tree)]
}
- val SyntacticIdent: SyntacticIdentExtractor
- trait SyntacticIdentExtractor {
- def apply(name: Name, isBackquoted: Boolean = false): Ident
- def unapply(tree: Ident): Option[(Name, Boolean)]
+ val SyntacticTermIdent: SyntacticTermIdentExtractor
+ trait SyntacticTermIdentExtractor {
+ def apply(name: TermName, isBackquoted: Boolean = false): Ident
+ def unapply(id: Ident): Option[(TermName, Boolean)]
+ }
+
+ val SyntacticTypeIdent: SyntacticTypeIdentExtractor
+ trait SyntacticTypeIdentExtractor {
+ def apply(name: TypeName): Ident
+ def unapply(tree: Tree): Option[TypeName]
}
val SyntacticImport: SyntacticImportExtractor
@@ -803,6 +809,36 @@ trait Internals { self: Universe =>
def apply(qual: Tree, name: TermName): Select
def unapply(tree: Tree): Option[(Tree, TermName)]
}
+
+ val SyntacticCompoundType: SyntacticCompoundTypeExtractor
+ trait SyntacticCompoundTypeExtractor {
+ def apply(parents: List[Tree], defns: List[Tree]): CompoundTypeTree
+ def unapply(tree: Tree): Option[(List[Tree], List[Tree])]
+ }
+
+ val SyntacticSingletonType: SyntacitcSingletonTypeExtractor
+ trait SyntacitcSingletonTypeExtractor {
+ def apply(tree: Tree): SingletonTypeTree
+ def unapply(tree: Tree): Option[Tree]
+ }
+
+ val SyntacticTypeProjection: SyntacticTypeProjectionExtractor
+ trait SyntacticTypeProjectionExtractor {
+ def apply(qual: Tree, name: TypeName): SelectFromTypeTree
+ def unapply(tree: Tree): Option[(Tree, TypeName)]
+ }
+
+ val SyntacticAnnotatedType: SyntacticAnnotatedTypeExtractor
+ trait SyntacticAnnotatedTypeExtractor {
+ def apply(tpt: Tree, annot: Tree): Annotated
+ def unapply(tree: Tree): Option[(Tree, Tree)]
+ }
+
+ val SyntacticExistentialType: SyntacticExistentialTypeExtractor
+ trait SyntacticExistentialTypeExtractor {
+ def apply(tpt: Tree, where: List[Tree]): ExistentialTypeTree
+ def unapply(tree: Tree): Option[(Tree, List[MemberDef])]
+ }
}
@deprecated("Use `internal.reificationSupport` instead", "2.11.0")