@@ -286,35 +286,35 @@ trait ConstraintHandling {
286286 }
287287 }
288288
289- /** If `tp` is an intersection such that some operands are super trait instances
290- * and others are not, replace as many super trait instances as possible with Any
289+ /** If `tp` is an intersection such that some operands are mixin trait instances
290+ * and others are not, replace as many mixin trait instances as possible with Any
291291 * as long as the result is still a subtype of `bound`. But fall back to the
292292 * original type if the resulting widened type is a supertype of all dropped
293- * types (since in this case the type was not a true intersection of super traits
293+ * types (since in this case the type was not a true intersection of mixin traits
294294 * and other types to start with).
295295 */
296- def dropSuperTraits (tp : Type , bound : Type )(using Context ): Type =
296+ def dropMixinTraits (tp : Type , bound : Type )(using Context ): Type =
297297 var kept : Set [Type ] = Set () // types to keep since otherwise bound would not fit
298298 var dropped : List [Type ] = List () // the types dropped so far, last one on top
299299
300- def dropOneSuperTrait (tp : Type ): Type =
300+ def dropOneMixinTrait (tp : Type ): Type =
301301 val tpd = tp.dealias
302- if tpd.typeSymbol.isSuperTrait && ! tpd.isLambdaSub && ! kept.contains(tpd) then
302+ if tpd.typeSymbol.isMixinTrait && ! tpd.isLambdaSub && ! kept.contains(tpd) then
303303 dropped = tpd :: dropped
304304 defn.AnyType
305305 else tpd match
306306 case AndType (tp1, tp2) =>
307- val tp1w = dropOneSuperTrait (tp1)
307+ val tp1w = dropOneMixinTrait (tp1)
308308 if tp1w ne tp1 then tp1w & tp2
309309 else
310- val tp2w = dropOneSuperTrait (tp2)
310+ val tp2w = dropOneMixinTrait (tp2)
311311 if tp2w ne tp2 then tp1 & tp2w
312312 else tpd
313313 case _ =>
314314 tp
315315
316316 def recur (tp : Type ): Type =
317- val tpw = dropOneSuperTrait (tp)
317+ val tpw = dropOneMixinTrait (tp)
318318 if tpw eq tp then tp
319319 else if tpw <:< bound then recur(tpw)
320320 else
@@ -324,15 +324,15 @@ trait ConstraintHandling {
324324
325325 val tpw = recur(tp)
326326 if (tpw eq tp) || dropped.forall(_ frozen_<:< tpw) then tp else tpw
327- end dropSuperTraits
327+ end dropMixinTraits
328328
329329 /** Widen inferred type `inst` with upper `bound`, according to the following rules:
330330 * 1. If `inst` is a singleton type, or a union containing some singleton types,
331331 * widen (all) the singleton type(s), provided the result is a subtype of `bound`
332332 * (i.e. `inst.widenSingletons <:< bound` succeeds with satisfiable constraint)
333333 * 2. If `inst` is a union type, approximate the union type from above by an intersection
334334 * of all common base types, provided the result is a subtype of `bound`.
335- * 3. drop super traits from intersections (see @dropSuperTraits )
335+ * 3. drop mixin traits from intersections (see @dropMixinTraits )
336336 *
337337 * Don't do these widenings if `bound` is a subtype of `scala.Singleton`.
338338 * Also, if the result of these widenings is a TypeRef to a module class,
@@ -357,7 +357,7 @@ trait ConstraintHandling {
357357
358358 val wideInst =
359359 if isSingleton(bound) then inst
360- else dropSuperTraits (widenOr(widenSingle(inst)), bound)
360+ else dropMixinTraits (widenOr(widenSingle(inst)), bound)
361361 wideInst match
362362 case wideInst : TypeRef if wideInst.symbol.is(Module ) =>
363363 TermRef (wideInst.prefix, wideInst.symbol.sourceModule)
0 commit comments