aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-20 14:50:51 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-20 14:50:51 +0100
commit608fbca82816c6b43def0b38de5f93133954e8ae (patch)
tree0cdce44f110c058d311529f0989b4d5d7316e747 /src/dotty/tools/dotc/core/Types.scala
parent0a8c17efca37e14b8467d7da9ffd6c48c8cd1c0f (diff)
downloaddotty-608fbca82816c6b43def0b38de5f93133954e8ae.tar.gz
dotty-608fbca82816c6b43def0b38de5f93133954e8ae.tar.bz2
dotty-608fbca82816c6b43def0b38de5f93133954e8ae.zip
For a typeRef, prefer info.isAlias over symbol.isAliasType
Reason: This works even for typeRefs with joint-ref denotations, even if the symbol does not exist. The only reason to use symbol.isAliasType is if info.isAlias can produce a cycle.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 9d6faef75..b628d9c50 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -173,9 +173,16 @@ object Types {
final def occursIn(that: Type)(implicit ctx: Context): Boolean =
that existsPart (this == _)
+ /** Is this a type of a repeated parameter? */
def isRepeatedParam(implicit ctx: Context): Boolean =
defn.RepeatedParamClasses contains typeSymbol
+ /** Is this an alias TypeBounds? */
+ def isAlias: Boolean = this match {
+ case TypeBounds(lo, hi) => lo eq hi
+ case _ => false
+ }
+
// ----- Higher-order combinators -----------------------------------
/** Returns true if there is a part of this type that satisfies predicate `p`.
@@ -672,7 +679,7 @@ object Types {
*/
final def normalizedPrefix(implicit ctx: Context): Type = this match {
case tp: NamedType =>
- if (tp.symbol.isAliasType) tp.info.normalizedPrefix else tp.prefix
+ if (tp.symbol.info.isAlias) tp.info.normalizedPrefix else tp.prefix
case tp: ClassInfo =>
tp.prefix
case tp: TypeProxy =>