@@ -465,35 +465,29 @@ class SILTypeSubstituter :
465
465
466
466
} // end anonymous namespace
467
467
468
- static bool isSubstitutionInvariant (SILType ty,
469
- bool shouldSubstituteOpaqueArchetypes) {
468
+ static bool isSubstitutionInvariant (SILType ty, SubstOptions options) {
470
469
return (!ty.hasArchetype () &&
471
470
!ty.hasTypeParameter () &&
472
- (!shouldSubstituteOpaqueArchetypes ||
471
+ (!options. contains (SubstFlags::SubstituteOpaqueArchetypes) ||
473
472
!ty.getRawASTType ()->hasOpaqueArchetype ()));
474
473
}
475
474
476
475
SILType SILType::subst (TypeConverter &tc, TypeSubstitutionFn subs,
477
476
LookupConformanceFn conformances,
478
477
CanGenericSignature genericSig,
479
- bool shouldSubstituteOpaqueArchetypes ) const {
480
- if (isSubstitutionInvariant (*this , shouldSubstituteOpaqueArchetypes ))
478
+ SubstOptions options ) const {
479
+ if (isSubstitutionInvariant (*this , options ))
481
480
return *this ;
482
481
483
- auto substOptions =
484
- (shouldSubstituteOpaqueArchetypes
485
- ? SubstOptions (SubstFlags::SubstituteOpaqueArchetypes)
486
- : SubstOptions (None));
487
- InFlightSubstitution IFS (subs, conformances, substOptions);
488
-
482
+ InFlightSubstitution IFS (subs, conformances, options);
489
483
SILTypeSubstituter STST (tc, TypeExpansionContext::minimal (), IFS,
490
484
genericSig);
491
485
return STST.subst (*this );
492
486
}
493
487
494
488
SILType SILType::subst (TypeConverter &tc, InFlightSubstitution &IFS,
495
489
CanGenericSignature genericSig) const {
496
- if (isSubstitutionInvariant (*this , IFS.shouldSubstituteOpaqueArchetypes ()))
490
+ if (isSubstitutionInvariant (*this , IFS.getOptions ()))
497
491
return *this ;
498
492
499
493
SILTypeSubstituter STST (tc, TypeExpansionContext::minimal (), IFS,
@@ -504,9 +498,8 @@ SILType SILType::subst(TypeConverter &tc, InFlightSubstitution &IFS,
504
498
SILType SILType::subst (SILModule &M, TypeSubstitutionFn subs,
505
499
LookupConformanceFn conformances,
506
500
CanGenericSignature genericSig,
507
- bool shouldSubstituteOpaqueArchetypes) const {
508
- return subst (M.Types , subs, conformances, genericSig,
509
- shouldSubstituteOpaqueArchetypes);
501
+ SubstOptions options) const {
502
+ return subst (M.Types , subs, conformances, genericSig, options);
510
503
}
511
504
512
505
SILType SILType::subst (TypeConverter &tc, SubstitutionMap subs) const {
@@ -521,7 +514,7 @@ SILType SILType::subst(SILModule &M, SubstitutionMap subs) const{
521
514
522
515
SILType SILType::subst (SILModule &M, SubstitutionMap subs,
523
516
TypeExpansionContext context) const {
524
- if (isSubstitutionInvariant (*this , false ))
517
+ if (isSubstitutionInvariant (*this , None ))
525
518
return *this ;
526
519
527
520
InFlightSubstitutionViaSubMap IFS (subs, None);
0 commit comments