aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorliu fengyun <liufengyunchina@gmail.com>2016-07-21 10:41:59 +0200
committerliu fengyun <liufengyunchina@gmail.com>2016-08-24 10:26:58 +0200
commit1a7618f32c6d8060c3a87ce633645440d500aa7a (patch)
treec61d576426280d36417e64198716c71aa9e0b6ca /src/dotty/tools/dotc/core/Types.scala
parent265ade02e522c89844076b5339267eac08e44c37 (diff)
downloaddotty-1a7618f32c6d8060c3a87ce633645440d500aa7a.tar.gz
dotty-1a7618f32c6d8060c3a87ce633645440d500aa7a.tar.bz2
dotty-1a7618f32c6d8060c3a87ce633645440d500aa7a.zip
implementation of exhaustivity and redundancy check
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 1bfd6eaee..ad27f924e 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -841,6 +841,13 @@ object Types {
case _ => this
}
+ /** Eliminate anonymous classes */
+ final def deAnonymize(implicit ctx: Context): Type = this match {
+ case tp:TypeRef if tp.symbol.isAnonymousClass =>
+ tp.symbol.asClass.typeRef.asSeenFrom(tp.prefix, tp.symbol.owner)
+ case tp => tp
+ }
+
/** Follow aliases and dereferences LazyRefs and instantiated TypeVars until type
* is no longer alias type, LazyRef, or instantiated type variable.
*/