Skip to content

Commit

Permalink
refactor to simplify definition of FlexibleType
Browse files Browse the repository at this point in the history
  • Loading branch information
olhotak committed Jul 21, 2023
1 parent 2286f01 commit 202fb91
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3347,19 +3347,12 @@ object Types {

// --- FlexibleType -----------------------------------------------------------------

case class FlexibleType(tp: Type) extends CachedGroundType with ValueType {
def hi(using Context) = {
this.tp
}
def lo(using Context) = {
OrNull(this.tp)
}
override def show(using Context) = "FlexibleType("+tp.show+")"
def underlying(using Context) : Type = this.tp
case class FlexibleType(underlying: Type) extends CachedGroundType with ValueType {
def lo(using Context): Type = OrNull(underlying)
override def show(using Context) = i"FlexibleType($underlying)"
def derivedFlexibleType(under: Type)(using Context): Type =
if this.tp eq under then this else FlexibleType(under)
override def computeHash(bs: Binders): Int = doHash(bs, tp)
override def toString = "FlexibleType(%s)".format(tp)
if this.underlying eq under then this else FlexibleType(under)
override def computeHash(bs: Binders): Int = doHash(bs, underlying)
override final def baseClasses(using Context): List[ClassSymbol] = underlying.baseClasses
}

Expand Down

0 comments on commit 202fb91

Please sign in to comment.