diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-24 09:43:33 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-24 09:43:33 +0100 |
commit | 15bc45cd76445d5d3e8566492fc54b7e4b8f22e3 (patch) | |
tree | 19f02038468f12ddfae23295a1817a4453d5de75 /src/dotty/tools/dotc/core/Types.scala | |
parent | 4f41454cbd1563926f4005d2ee1268538a6b22b1 (diff) | |
download | dotty-15bc45cd76445d5d3e8566492fc54b7e4b8f22e3.tar.gz dotty-15bc45cd76445d5d3e8566492fc54b7e4b8f22e3.tar.bz2 dotty-15bc45cd76445d5d3e8566492fc54b7e4b8f22e3.zip |
Refining checkClassTypeWithStablePrefix
Needs to unwrap parameters. While we are at it, breaking out common functionality in underlyingClassRef.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 93db5d624..64fa4d3ec 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -596,6 +596,17 @@ object Types { def underlyingIfRepeated(implicit ctx: Context): Type = this.translateParameterized(defn.RepeatedParamClass, defn.SeqClass) + /** If this is a (possibly aliased, annotated, and parameterized) reference to + * a class, the class type ref, otherwise NoType. + */ + def underlyingClassRef(implicit ctx: Context): Type = dealias match { + case tp: TypeRef if tp.symbol.isClass => tp + case tp: TypeVar => tp.underlying.underlyingClassRef + case tp: AnnotatedType => tp.underlying.underlyingClassRef + case tp: RefinedType => tp.underlying.underlyingClassRef + case _ => NoType + } + /** A prefix-less termRef to a new skolem symbol that has the given type as info */ def narrow(implicit ctx: Context): TermRef = TermRef(NoPrefix, ctx.newSkolem(this)) |