@@ -1374,54 +1374,57 @@ object Types {
1374
1374
case Atoms .Unknown => Atoms .Unknown
1375
1375
case _ => Atoms .Unknown
1376
1376
1377
- private def dealias1 (keep : AnnotatedType => Context ?=> Boolean , keepOpaques : Boolean )(using Context ): Type = this match {
1377
+ private def dealias1 (keep : AnnotatedType => Context ?=> Boolean , keepOpaques : Boolean , keepSplicedTypes : Boolean )(using Context ): Type = this match {
1378
1378
case tp : TypeRef =>
1379
1379
if (tp.symbol.isClass) tp
1380
1380
else tp.info match {
1381
- case TypeAlias (alias) if ! (keepOpaques && tp.symbol.is(Opaque )) =>
1382
- alias.dealias1(keep, keepOpaques)
1381
+ case TypeAlias (alias) if ! (keepOpaques && tp.symbol.is(Opaque )) && ! (keepSplicedTypes && tp.symbol.hasAnnotation(defn. QuotedRuntime_SplicedTypeAnnot )) =>
1382
+ alias.dealias1(keep, keepOpaques, keepSplicedTypes )
1383
1383
case _ => tp
1384
1384
}
1385
1385
case app @ AppliedType (tycon, _) =>
1386
- val tycon1 = tycon.dealias1(keep, keepOpaques)
1387
- if (tycon1 ne tycon) app.superType.dealias1(keep, keepOpaques)
1386
+ val tycon1 = tycon.dealias1(keep, keepOpaques, keepSplicedTypes )
1387
+ if (tycon1 ne tycon) app.superType.dealias1(keep, keepOpaques, keepSplicedTypes )
1388
1388
else this
1389
1389
case tp : TypeVar =>
1390
1390
val tp1 = tp.instanceOpt
1391
- if (tp1.exists) tp1.dealias1(keep, keepOpaques) else tp
1391
+ if (tp1.exists) tp1.dealias1(keep, keepOpaques, keepSplicedTypes ) else tp
1392
1392
case tp : AnnotatedType =>
1393
- val parent1 = tp.parent.dealias1(keep, keepOpaques)
1393
+ val parent1 = tp.parent.dealias1(keep, keepOpaques, keepSplicedTypes )
1394
1394
tp match
1395
1395
case tp @ CapturingType (parent, refs) =>
1396
1396
tp.derivedCapturingType(parent1, refs)
1397
1397
case _ =>
1398
1398
if keep(tp) then tp.derivedAnnotatedType(parent1, tp.annot)
1399
1399
else parent1
1400
1400
case tp : LazyRef =>
1401
- tp.ref.dealias1(keep, keepOpaques)
1401
+ tp.ref.dealias1(keep, keepOpaques, keepSplicedTypes )
1402
1402
case _ => this
1403
1403
}
1404
1404
1405
1405
/** Follow aliases and dereferences LazyRefs, annotated types and instantiated
1406
1406
* TypeVars until type is no longer alias type, annotated type, LazyRef,
1407
1407
* or instantiated type variable.
1408
1408
*/
1409
- final def dealias (using Context ): Type = dealias1(keepNever, keepOpaques = false )
1409
+ final def dealias (using Context ): Type = dealias1(keepNever, keepOpaques = false , keepSplicedTypes = false )
1410
1410
1411
1411
/** Follow aliases and dereferences LazyRefs and instantiated TypeVars until type
1412
1412
* is no longer alias type, LazyRef, or instantiated type variable.
1413
1413
* Goes through annotated types and rewraps annotations on the result.
1414
1414
*/
1415
- final def dealiasKeepAnnots (using Context ): Type = dealias1(keepAlways, keepOpaques = false )
1415
+ final def dealiasKeepAnnots (using Context ): Type = dealias1(keepAlways, keepOpaques = false , keepSplicedTypes = false )
1416
1416
1417
1417
/** Like `dealiasKeepAnnots`, but keeps only refining annotations */
1418
- final def dealiasKeepRefiningAnnots (using Context ): Type = dealias1(keepIfRefining, keepOpaques = false )
1418
+ final def dealiasKeepRefiningAnnots (using Context ): Type = dealias1(keepIfRefining, keepOpaques = false , keepSplicedTypes = false )
1419
1419
1420
1420
/** Follow non-opaque aliases and dereferences LazyRefs, annotated types and instantiated
1421
1421
* TypeVars until type is no longer alias type, annotated type, LazyRef,
1422
1422
* or instantiated type variable.
1423
1423
*/
1424
- final def dealiasKeepOpaques (using Context ): Type = dealias1(keepNever, keepOpaques = true )
1424
+ final def dealiasKeepOpaques (using Context ): Type = dealias1(keepNever, keepOpaques = true , keepSplicedTypes = false )
1425
+
1426
+ /** Like `dealias`, but keeps aliases marked with `@SplicedType` */
1427
+ final def dealiasKeepSpliceTypes (using Context ): Type = dealias1(keepNever, keepOpaques = true , keepSplicedTypes = true )
1425
1428
1426
1429
/** Approximate this type with a type that does not contain skolem types. */
1427
1430
final def deskolemized (using Context ): Type =
@@ -1449,7 +1452,7 @@ object Types {
1449
1452
def tryNormalize (using Context ): Type = NoType
1450
1453
1451
1454
private def widenDealias1 (keep : AnnotatedType => Context ?=> Boolean )(using Context ): Type = {
1452
- val res = this .widen.dealias1(keep, keepOpaques = false )
1455
+ val res = this .widen.dealias1(keep, keepOpaques = false , keepSplicedTypes = false )
1453
1456
if (res eq this ) res else res.widenDealias1(keep)
1454
1457
}
1455
1458
0 commit comments