summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api/Types.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-19 19:19:54 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-19 19:19:54 +0200
commita2d1b23dbee55a905eecdfeeafad8701b726621b (patch)
treeaba11d876b4649935b98494582e473d588ccf068 /src/reflect/scala/reflect/api/Types.scala
parent32d42b1264bd52578957abffe312a128ac23122b (diff)
downloadscala-a2d1b23dbee55a905eecdfeeafad8701b726621b.tar.gz
scala-a2d1b23dbee55a905eecdfeeafad8701b726621b.tar.bz2
scala-a2d1b23dbee55a905eecdfeeafad8701b726621b.zip
adds `narrow` to the reflection API
as per https://issues.scala-lang.org/browse/SI-5951
Diffstat (limited to 'src/reflect/scala/reflect/api/Types.scala')
-rw-r--r--src/reflect/scala/reflect/api/Types.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index b62a92cbd7..b797c71f6d 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -121,7 +121,7 @@ trait Types extends base.Types { self: Universe =>
* class C extends p.D[Int]
* T.asSeenFrom(ThisType(C), D) (where D is owner of m)
* = Int
- * }}}
+ * }}}
*/
def asSeenFrom(pre: Type, clazz: Symbol): Type
@@ -171,6 +171,15 @@ trait Types extends base.Types { self: Universe =>
*/
def widen: Type
+ /** Map to a singleton type which is a subtype of this type.
+ * The fallback implemented here gives:
+ * {{{
+ * T.narrow = (T {}).this.type
+ * }}}
+ * Overridden where we know more about where types come from.
+ */
+ def narrow: Type
+
/** The string discriminator of this type; useful for debugging */
def kind: String
}
@@ -365,4 +374,3 @@ trait Types extends base.Types { self: Universe =>
*/
def existentialAbstraction(tparams: List[Symbol], tpe0: Type): Type
}
-