aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-08 17:11:54 +0100
committerMartin Odersky <odersky@gmail.com>2017-03-08 17:11:54 +0100
commitc6685d520df9cd428019f741f2eeb153af02ac2b (patch)
tree7e4252db1f76ab2a573de7a0a4993cb6090d6f56 /compiler/src/dotty/tools
parentebc316272deb2e2c3cd00659af453d5ac6a9a6ee (diff)
downloaddotty-c6685d520df9cd428019f741f2eeb153af02ac2b.tar.gz
dotty-c6685d520df9cd428019f741f2eeb153af02ac2b.tar.bz2
dotty-c6685d520df9cd428019f741f2eeb153af02ac2b.zip
Better fix
`superType` should never return a `TypeBounds` in the first place. This commit makes sure it doesn't.
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeOps.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala10
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
index 6e9e1f2e5..6c40794e3 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -239,7 +239,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
case tp1: RecType =>
tp1.rebind(approximateOr(tp1.parent, tp2))
case tp1: TypeProxy if !isClassRef(tp1) =>
- orDominator(tp1.superType.bounds.hi | tp2)
+ orDominator(tp1.superType | tp2)
case _ =>
tp2 match {
case tp2: RecType =>
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) {