Skip to content

Commit 0d434f9

Browse files
committed
Special case for TypeRefs in upperbound
Done for efficiency. Also that way we would do something meaningful if the type constructor was, say, Nothing. However, that case is now rules out anyways.
1 parent a4c971c commit 0d434f9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2748,7 +2748,12 @@ object Types {
27482748
override def computeHash = doHash(tycon, args)
27492749

27502750
def upperBound(implicit ctx: Context): Type = tycon match {
2751-
case tp: TypeProxy => tp.underlying.bounds.hi.appliedTo(args)
2751+
case tp: TypeRef =>
2752+
tp.info match {
2753+
case TypeBounds(_, hi) => hi.appliedTo(args)
2754+
case _ => tp
2755+
}
2756+
case tp: TypeProxy => tp.underlying.appliedTo(args)
27522757
case _ => defn.AnyType
27532758
}
27542759

0 commit comments

Comments
 (0)