From c6685d520df9cd428019f741f2eeb153af02ac2b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 8 Mar 2017 17:11:54 +0100 Subject: Better fix `superType` should never return a `TypeBounds` in the first place. This commit makes sure it doesn't. --- compiler/src/dotty/tools/dotc/core/Types.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala') diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 9dd767a8e..6aa77de52 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -1276,7 +1276,10 @@ object Types { * except for TypeRefs where the upper bound is returned, and HKApplys, * where the upper bound of the constructor is re-applied to the arguments. */ - def superType(implicit ctx: Context): Type = underlying + def superType(implicit ctx: Context): Type = underlying match { + case TypeBounds(_, hi) => hi + case st => st + } } // Every type has to inherit one of the following four abstract type classes., @@ -1762,11 +1765,6 @@ object Types { type ThisType = TypeRef override def underlying(implicit ctx: Context): Type = info - - override def superType(implicit ctx: Context): Type = info match { - case TypeBounds(_, hi) => hi - case _ => info - } } final class TermRefWithSignature(prefix: Type, name: TermName, override val sig: Signature) extends TermRef(prefix, name) { -- cgit v1.2.3