Skip to content

Commit d0995ce

Browse files
committed
Tweak: Print Ranges like regular types
1 parent 4195533 commit d0995ce

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6045,14 +6045,10 @@ object Types {
60456045
/** A range of possible types between lower bound `lo` and upper bound `hi`.
60466046
* Only used internally in `ApproximatingTypeMap`.
60476047
*/
6048-
case class Range(lo: Type, hi: Type) extends UncachedGroundType {
6048+
case class Range(lo: Type, hi: Type) extends UncachedGroundType:
60496049
assert(!lo.isInstanceOf[Range])
60506050
assert(!hi.isInstanceOf[Range])
60516051

6052-
override def toText(printer: Printer): Text =
6053-
lo.toText(printer) ~ ".." ~ hi.toText(printer)
6054-
}
6055-
60566052
/** Approximate wildcards by their bounds */
60576053
class AvoidWildcardsMap(using Context) extends ApproximatingTypeMap:
60586054
protected def mapWild(t: WildcardType) =

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
278278
case ex: Throwable => Str("...")
279279
}
280280
"LazyRef(" ~ refTxt ~ ")"
281+
case Range(lo, hi) =>
282+
toText(lo) ~ ".." ~ toText(hi)
281283
case _ =>
282284
tp.fallbackToText(this)
283285
}

0 commit comments

Comments
 (0)