Skip to content

Commit 202fb91

Browse files
committed
refactor to simplify definition of FlexibleType
1 parent 2286f01 commit 202fb91

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

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

+5-12
Original file line numberDiff line numberDiff line change
@@ -3347,19 +3347,12 @@ object Types {
33473347

33483348
// --- FlexibleType -----------------------------------------------------------------
33493349

3350-
case class FlexibleType(tp: Type) extends CachedGroundType with ValueType {
3351-
def hi(using Context) = {
3352-
this.tp
3353-
}
3354-
def lo(using Context) = {
3355-
OrNull(this.tp)
3356-
}
3357-
override def show(using Context) = "FlexibleType("+tp.show+")"
3358-
def underlying(using Context) : Type = this.tp
3350+
case class FlexibleType(underlying: Type) extends CachedGroundType with ValueType {
3351+
def lo(using Context): Type = OrNull(underlying)
3352+
override def show(using Context) = i"FlexibleType($underlying)"
33593353
def derivedFlexibleType(under: Type)(using Context): Type =
3360-
if this.tp eq under then this else FlexibleType(under)
3361-
override def computeHash(bs: Binders): Int = doHash(bs, tp)
3362-
override def toString = "FlexibleType(%s)".format(tp)
3354+
if this.underlying eq under then this else FlexibleType(under)
3355+
override def computeHash(bs: Binders): Int = doHash(bs, underlying)
33633356
override final def baseClasses(using Context): List[ClassSymbol] = underlying.baseClasses
33643357
}
33653358

0 commit comments

Comments
 (0)