Skip to content

Commit acb6165

Browse files
committed
Address other reviewer comments
1 parent a0b6910 commit acb6165

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
6161
toPrefix(pre, cls, tp.cls)
6262
case _: BoundType | NoPrefix =>
6363
tp
64-
case tp: RefinedType => //@!!!
64+
case tp: RefinedType => //@!!! todo: remove
6565
derivedRefinedType(tp, apply(tp.parent), apply(tp.refinedInfo))
6666
case _ =>
6767
mapOver(tp)

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,11 +4025,7 @@ object Types {
40254025
case Range(infoLo: TypeBounds, infoHi: TypeBounds) =>
40264026
assert(variance == 0)
40274027
if (!infoLo.isAlias && !infoHi.isAlias) propagate(infoLo, infoHi)
4028-
else range(tp.bottomType, tp.topType)
4029-
// Using `parent` instead of `tp.topType` would be better for normal refinements,
4030-
// but it would also turn *-types into hk-types, which is not what we want.
4031-
// We should revisit this point in case we represent applied types not as refinements anymore.
4032-
// @!!! revisit
4028+
else range(tp.bottomType, tp.parent)
40334029
case Range(infoLo, infoHi) =>
40344030
propagate(infoLo, infoHi)
40354031
case _ =>
@@ -4112,7 +4108,7 @@ object Types {
41124108
else tp.derivedAndOrType(tp1, tp2)
41134109

41144110
override protected def derivedTypeArgRef(tp: TypeArgRef, prefix: Type): Type =
4115-
if (isRange(prefix))
4111+
if (isRange(prefix)) // TODO: explain
41164112
tp.underlying match {
41174113
case TypeBounds(lo, hi) => range(atVariance(-variance)(reapply(lo)), reapply(hi))
41184114
case _ => range(tp.bottomType, tp.topType)
@@ -4245,10 +4241,7 @@ object Types {
42454241
this(x, tp.info)
42464242

42474243
case tp @ TypeArgRef(prefix, _, _) =>
4248-
val saved = variance
4249-
variance = 0
4250-
try this(x, prefix)
4251-
finally variance = saved
4244+
atVariance(0)(this(x, prefix))
42524245

42534246
case AnnotatedType(underlying, annot) =>
42544247
this(applyToAnnot(x, annot), underlying)

compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ object ExplicitOuter {
162162
* @param flags The flags of the outer accessor
163163
*
164164
* The type of the outer accessor is computed as follows:
165-
* Let O[X1, .., Xn] be the class eclosing `cls`.
165+
* Let O[X1, .., Xn] be the class enclosing `cls`.
166166
* - if owner == cls, O[X1, ..., Xn]
167167
* - otherwise, if the class P enclosing `owner` derives from O, the
168-
* base type of P.this of class O
168+
* base type of P.this wrt class O
169169
* - otherwise O[_, ..., _]
170170
*/
171171
private def newOuterSym(owner: ClassSymbol, cls: ClassSymbol, name: TermName, flags: FlagSet)(implicit ctx: Context) = {

compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ object ErrorReporting {
158158
reported.setVariance(-1)
159159
val expected1 = reported(expected)
160160
val (found2, expected2) =
161-
if (found1 <:< expected1) (found, expected) else (found1, expected1)
161+
if (found1 frozen_<:< expected1) (found, expected) else (found1, expected1)
162162
TypeMismatch(found2, expected2, whyNoMatchStr(found, expected), postScript)
163163
}
164164

0 commit comments

Comments
 (0)