Skip to content

Commit c5b57f1

Browse files
committed
Address reviewers comments
1 parent 0db70ab commit c5b57f1

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
@@ -3863,14 +3863,6 @@ object Types {
38633863
def apply(tp: Type) = tp
38643864
}
38653865

3866-
case class Range(lo: Type, hi: Type) extends UncachedGroundType {
3867-
assert(!lo.isInstanceOf[Range])
3868-
assert(!hi.isInstanceOf[Range])
3869-
3870-
override def toText(printer: Printer): Text =
3871-
lo.toText(printer) ~ ".." ~ hi.toText(printer)
3872-
}
3873-
38743866
/** A type map that approximates TypeBounds types depending on
38753867
* variance.
38763868
*
@@ -3995,9 +3987,11 @@ object Types {
39953987
case Range(lo, hi) :: args1 =>
39963988
val v = tparams.head.paramVariance
39973989
if (v == 0) false
3998-
else if (v > 0) { loBuf += lo; hiBuf += hi }
3999-
else { loBuf += hi; hiBuf += lo }
4000-
distributeArgs(args1, tparams.tail)
3990+
else {
3991+
if (v > 0) { loBuf += lo; hiBuf += hi }
3992+
else { loBuf += hi; hiBuf += lo }
3993+
distributeArgs(args1, tparams.tail)
3994+
}
40013995
case arg :: args1 =>
40023996
loBuf += arg; hiBuf += arg
40033997
distributeArgs(args1, tparams.tail)
@@ -4047,6 +4041,17 @@ object Types {
40474041
protected def reapply(tp: Type): Type = apply(tp)
40484042
}
40494043

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

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

0 commit comments

Comments
 (0)