aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-22 16:19:09 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-22 16:20:42 +0100
commit70e57128bb7623998f76aaf2ad8541d438b4b2b8 (patch)
tree9ed809c518562ef87a5b57f9a580d042e1ca3e95 /src/dotty/tools/dotc/core/TypeOps.scala
parent5bf4a7188afdf336186bd200d963828e2bcc27e0 (diff)
downloaddotty-70e57128bb7623998f76aaf2ad8541d438b4b2b8.tar.gz
dotty-70e57128bb7623998f76aaf2ad8541d438b4b2b8.tar.bz2
dotty-70e57128bb7623998f76aaf2ad8541d438b4b2b8.zip
Normalize parents to be class refs
Previously, alias type refs were also accepted. But this is the wrong assumption for computeMembersNames. So, e.g. instead of leaving an AnyRef we now expand to Object. Also making ==, != take an Any instead of Object
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index cce6cc350..c42f0bb36 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -86,10 +86,10 @@ trait TypeOps { this: Context =>
}
/** Normalize a list of parent types of class `cls` that may contain refinements
- * to a list of typerefs, by converting all refinements to member
+ * to a list of typerefs referring to classes, by converting all refinements to member
* definitions in scope `decls`. Can add members to `decls` as a side-effect.
*/
- def normalizeToRefs(parents: List[Type], cls: ClassSymbol, decls: Scope): List[TypeRef] = {
+ def normalizeToClassRefs(parents: List[Type], cls: ClassSymbol, decls: Scope): List[TypeRef] = {
def enterArgBinding(formal: Symbol, info: Type) = {
val typeArgFlag = if (formal is Local) TypeArgument else EmptyFlags
@@ -144,7 +144,8 @@ trait TypeOps { this: Context =>
formals = formals.updated(name, tp1.typeParamNamed(name))
normalizeToRef(tp1)
case tp: TypeRef =>
- tp
+ if (tp.symbol.isAliasType) normalizeToRef(tp.info.bounds.hi)
+ else tp
case ErrorType =>
defn.AnyClass.typeRef
case _ =>