Skip to content

Commit 8475876

Browse files
committed
Cleanup: don't refer to members of defn directly
Extracted from 7659c11.
1 parent 11fffe0 commit 8475876

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
319319
thirdTry
320320
case tp1: TypeParamRef =>
321321
def flagNothingBound = {
322-
if (!frozenConstraint && tp2.isRef(defn.NothingClass) && state.isGlobalCommittable) {
322+
if (!frozenConstraint && tp2.isRef(NothingClass) && state.isGlobalCommittable) {
323323
def msg = s"!!! instantiated to Nothing: $tp1, constraint = ${constraint.show}"
324324
if (Config.failOnInstantiationToNothing) assert(false, msg)
325325
else ctx.log(msg)
@@ -404,7 +404,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
404404
if (cls2.isClass) {
405405
if (cls2.typeParams.isEmpty) {
406406
if (cls2 eq AnyKindClass) return true
407-
if (tp1.isRef(defn.NothingClass)) return true
407+
if (tp1.isRef(NothingClass)) return true
408408
if (tp1.isLambdaSub) return false
409409
// Note: We would like to replace this by `if (tp1.hasHigherKind)`
410410
// but right now we cannot since some parts of the standard library rely on the
@@ -417,7 +417,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
417417
val base = tp1.baseType(cls2)
418418
if (base.typeSymbol == cls2) return true
419419
}
420-
else if (tp1.isLambdaSub && !tp1.isRef(defn.AnyKindClass))
420+
else if (tp1.isLambdaSub && !tp1.isRef(AnyKindClass))
421421
return recur(tp1, EtaExpansion(cls2.typeRef))
422422
}
423423
fourthTry
@@ -1382,7 +1382,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
13821382
// at run time. It would not work to replace that with `Nothing`.
13831383
// However, maybe we can still apply the replacement to
13841384
// types which are not explicitly written.
1385-
defn.NothingType
1385+
NothingType
13861386
case _ => andType(tp1, tp2)
13871387
}
13881388
case _ => andType(tp1, tp2)
@@ -1393,8 +1393,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
13931393
}
13941394

13951395
/** The greatest lower bound of a list types */
1396-
final def glb(tps: List[Type]): Type =
1397-
((defn.AnyType: Type) /: tps)(glb)
1396+
final def glb(tps: List[Type]): Type = ((AnyType: Type) /: tps)(glb)
13981397

13991398
/** The least upper bound of two types
14001399
* @param canConstrain If true, new constraints might be added to simplify the lub.
@@ -1424,7 +1423,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
14241423

14251424
/** The least upper bound of a list of types */
14261425
final def lub(tps: List[Type]): Type =
1427-
((defn.NothingType: Type) /: tps)(lub(_,_, canConstrain = false))
1426+
((NothingType: Type) /: tps)(lub(_,_, canConstrain = false))
14281427

14291428
/** Try to produce joint arguments for a lub `A[T_1, ..., T_n] | A[T_1', ..., T_n']` using
14301429
* the following strategies:

0 commit comments

Comments
 (0)