diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-24 03:10:26 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-24 03:10:26 -0700 |
commit | 443562650cb0de1d5cc8a8daa0c35cde0c5d0ce7 (patch) | |
tree | f54bc01a9a438be29bbce932be5f647e1bd498a6 | |
parent | c1d67247de850876652215cfd61fe6a19dfa5b28 (diff) | |
parent | a2d1b23dbee55a905eecdfeeafad8701b726621b (diff) | |
download | scala-443562650cb0de1d5cc8a8daa0c35cde0c5d0ce7.tar.gz scala-443562650cb0de1d5cc8a8daa0c35cde0c5d0ce7.tar.bz2 scala-443562650cb0de1d5cc8a8daa0c35cde0c5d0ce7.zip |
Merge pull request #751 from scalamacros/topic/narrow
SI-5951 add `narrow` to the reflection API
-rw-r--r-- | src/reflect/scala/reflect/api/Types.scala | 12 |
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 } - |