Skip to content

Commit 5d7b043

Browse files
committed
Tweak: Print Ranges like regular types
1 parent 0381e2e commit 5d7b043

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
@@ -6035,14 +6035,10 @@ object Types {
60356035
/** A range of possible types between lower bound `lo` and upper bound `hi`.
60366036
* Only used internally in `ApproximatingTypeMap`.
60376037
*/
6038-
case class Range(lo: Type, hi: Type) extends UncachedGroundType {
6038+
case class Range(lo: Type, hi: Type) extends UncachedGroundType:
60396039
assert(!lo.isInstanceOf[Range])
60406040
assert(!hi.isInstanceOf[Range])
60416041

6042-
override def toText(printer: Printer): Text =
6043-
lo.toText(printer) ~ ".." ~ hi.toText(printer)
6044-
}
6045-
60466042
/** Approximate wildcards by their bounds */
60476043
class AvoidWildcardsMap(using Context) extends ApproximatingTypeMap:
60486044
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)