@@ -1160,17 +1160,14 @@ object Types extends TypeUtils {
1160
1160
*
1161
1161
* @param isSubType a function used for checking subtype relationships.
1162
1162
*/
1163
- final def overrides (that : Type , relaxedCheck : Boolean , matchLoosely : => Boolean , checkClassInfo : Boolean = true ,
1163
+ final def overrides (that : Type , matchLoosely : => Boolean , checkClassInfo : Boolean = true ,
1164
1164
isSubType : (Type , Type ) => Context ?=> Boolean = (tp1, tp2) => tp1 frozen_<:< tp2)(using Context ): Boolean = {
1165
- val overrideCtx = if relaxedCheck then ctx.relaxedOverrideContext else ctx
1166
- inContext(overrideCtx) {
1167
- ! checkClassInfo && this .isInstanceOf [ClassInfo ]
1168
- || isSubType(this .widenExpr, that.widenExpr)
1169
- || matchLoosely && {
1170
- val this1 = this .widenNullaryMethod
1171
- val that1 = that.widenNullaryMethod
1172
- ((this1 `ne` this ) || (that1 `ne` that)) && this1.overrides(that1, relaxedCheck, false , checkClassInfo)
1173
- }
1165
+ ! checkClassInfo && this .isInstanceOf [ClassInfo ]
1166
+ || isSubType(this .widenExpr, that.widenExpr)
1167
+ || matchLoosely && {
1168
+ val this1 = this .widenNullaryMethod
1169
+ val that1 = that.widenNullaryMethod
1170
+ ((this1 `ne` this ) || (that1 `ne` that)) && this1.overrides(that1, false , checkClassInfo)
1174
1171
}
1175
1172
}
1176
1173
@@ -1196,8 +1193,8 @@ object Types extends TypeUtils {
1196
1193
*/
1197
1194
def matches (that : Type )(using Context ): Boolean = {
1198
1195
record(" matches" )
1199
- val overrideCtx = if ctx.explicitNulls then ctx.relaxedOverrideContext else ctx
1200
- TypeComparer .matchesType(this , that, relaxed = ! ctx.phase.erasedTypes)( using overrideCtx )
1196
+ withoutMode( Mode . SafeNulls )(
1197
+ TypeComparer .matchesType(this , that, relaxed = ! ctx.phase.erasedTypes))
1201
1198
}
1202
1199
1203
1200
/** This is the same as `matches` except that it also matches => T with T and
0 commit comments