@@ -286,35 +286,35 @@ trait ConstraintHandling {
286
286
}
287
287
}
288
288
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
291
291
* as long as the result is still a subtype of `bound`. But fall back to the
292
292
* 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
294
294
* and other types to start with).
295
295
*/
296
- def dropSuperTraits (tp : Type , bound : Type )(using Context ): Type =
296
+ def dropMixinTraits (tp : Type , bound : Type )(using Context ): Type =
297
297
var kept : Set [Type ] = Set () // types to keep since otherwise bound would not fit
298
298
var dropped : List [Type ] = List () // the types dropped so far, last one on top
299
299
300
- def dropOneSuperTrait (tp : Type ): Type =
300
+ def dropOneMixinTrait (tp : Type ): Type =
301
301
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
303
303
dropped = tpd :: dropped
304
304
defn.AnyType
305
305
else tpd match
306
306
case AndType (tp1, tp2) =>
307
- val tp1w = dropOneSuperTrait (tp1)
307
+ val tp1w = dropOneMixinTrait (tp1)
308
308
if tp1w ne tp1 then tp1w & tp2
309
309
else
310
- val tp2w = dropOneSuperTrait (tp2)
310
+ val tp2w = dropOneMixinTrait (tp2)
311
311
if tp2w ne tp2 then tp1 & tp2w
312
312
else tpd
313
313
case _ =>
314
314
tp
315
315
316
316
def recur (tp : Type ): Type =
317
- val tpw = dropOneSuperTrait (tp)
317
+ val tpw = dropOneMixinTrait (tp)
318
318
if tpw eq tp then tp
319
319
else if tpw <:< bound then recur(tpw)
320
320
else
@@ -324,15 +324,15 @@ trait ConstraintHandling {
324
324
325
325
val tpw = recur(tp)
326
326
if (tpw eq tp) || dropped.forall(_ frozen_<:< tpw) then tp else tpw
327
- end dropSuperTraits
327
+ end dropMixinTraits
328
328
329
329
/** Widen inferred type `inst` with upper `bound`, according to the following rules:
330
330
* 1. If `inst` is a singleton type, or a union containing some singleton types,
331
331
* widen (all) the singleton type(s), provided the result is a subtype of `bound`
332
332
* (i.e. `inst.widenSingletons <:< bound` succeeds with satisfiable constraint)
333
333
* 2. If `inst` is a union type, approximate the union type from above by an intersection
334
334
* 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 )
336
336
*
337
337
* Don't do these widenings if `bound` is a subtype of `scala.Singleton`.
338
338
* Also, if the result of these widenings is a TypeRef to a module class,
@@ -357,7 +357,7 @@ trait ConstraintHandling {
357
357
358
358
val wideInst =
359
359
if isSingleton(bound) then inst
360
- else dropSuperTraits (widenOr(widenSingle(inst)), bound)
360
+ else dropMixinTraits (widenOr(widenSingle(inst)), bound)
361
361
wideInst match
362
362
case wideInst : TypeRef if wideInst.symbol.is(Module ) =>
363
363
TermRef (wideInst.prefix, wideInst.symbol.sourceModule)
0 commit comments