Skip to content

Commit 89180b5

Browse files
committed
Address reviewers comments
1 parent 08de553 commit 89180b5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,14 +3860,6 @@ object Types {
38603860
def apply(tp: Type) = tp
38613861
}
38623862

3863-
case class Range(lo: Type, hi: Type) extends UncachedGroundType {
3864-
assert(!lo.isInstanceOf[Range])
3865-
assert(!hi.isInstanceOf[Range])
3866-
3867-
override def toText(printer: Printer): Text =
3868-
lo.toText(printer) ~ ".." ~ hi.toText(printer)
3869-
}
3870-
38713863
/** A type map that approximates TypeBounds types depending on
38723864
* variance.
38733865
*
@@ -3992,9 +3984,11 @@ object Types {
39923984
case Range(lo, hi) :: args1 =>
39933985
val v = tparams.head.paramVariance
39943986
if (v == 0) false
3995-
else if (v > 0) { loBuf += lo; hiBuf += hi }
3996-
else { loBuf += hi; hiBuf += lo }
3997-
distributeArgs(args1, tparams.tail)
3987+
else {
3988+
if (v > 0) { loBuf += lo; hiBuf += hi }
3989+
else { loBuf += hi; hiBuf += lo }
3990+
distributeArgs(args1, tparams.tail)
3991+
}
39983992
case arg :: args1 =>
39993993
loBuf += arg; hiBuf += arg
40003994
distributeArgs(args1, tparams.tail)
@@ -4044,6 +4038,17 @@ object Types {
40444038
protected def reapply(tp: Type): Type = apply(tp)
40454039
}
40464040

4041+
/** A range of possible types between lower bound `lo` and upper bound `hi`.
4042+
* Only used internally in `ApproximatingTypeMap`.
4043+
*/
4044+
private case class Range(lo: Type, hi: Type) extends UncachedGroundType {
4045+
assert(!lo.isInstanceOf[Range])
4046+
assert(!hi.isInstanceOf[Range])
4047+
4048+
override def toText(printer: Printer): Text =
4049+
lo.toText(printer) ~ ".." ~ hi.toText(printer)
4050+
}
4051+
40474052
// ----- TypeAccumulators ----------------------------------------------------
40484053

40494054
abstract class TypeAccumulator[T](implicit protected val ctx: Context) extends ((T, Type) => T) {

0 commit comments

Comments
 (0)