@@ -465,35 +465,29 @@ class SILTypeSubstituter :
465465
466466} // end anonymous namespace
467467
468- static bool isSubstitutionInvariant (SILType ty,
469- bool shouldSubstituteOpaqueArchetypes) {
468+ static bool isSubstitutionInvariant (SILType ty, SubstOptions options) {
470469 return (!ty.hasArchetype () &&
471470 !ty.hasTypeParameter () &&
472- (!shouldSubstituteOpaqueArchetypes ||
471+ (!options. contains (SubstFlags::SubstituteOpaqueArchetypes) ||
473472 !ty.getRawASTType ()->hasOpaqueArchetype ()));
474473}
475474
476475SILType SILType::subst (TypeConverter &tc, TypeSubstitutionFn subs,
477476 LookupConformanceFn conformances,
478477 CanGenericSignature genericSig,
479- bool shouldSubstituteOpaqueArchetypes ) const {
480- if (isSubstitutionInvariant (*this , shouldSubstituteOpaqueArchetypes ))
478+ SubstOptions options ) const {
479+ if (isSubstitutionInvariant (*this , options ))
481480 return *this ;
482481
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);
489483 SILTypeSubstituter STST (tc, TypeExpansionContext::minimal (), IFS,
490484 genericSig);
491485 return STST.subst (*this );
492486}
493487
494488SILType SILType::subst (TypeConverter &tc, InFlightSubstitution &IFS,
495489 CanGenericSignature genericSig) const {
496- if (isSubstitutionInvariant (*this , IFS.shouldSubstituteOpaqueArchetypes ()))
490+ if (isSubstitutionInvariant (*this , IFS.getOptions ()))
497491 return *this ;
498492
499493 SILTypeSubstituter STST (tc, TypeExpansionContext::minimal (), IFS,
@@ -504,9 +498,8 @@ SILType SILType::subst(TypeConverter &tc, InFlightSubstitution &IFS,
504498SILType SILType::subst (SILModule &M, TypeSubstitutionFn subs,
505499 LookupConformanceFn conformances,
506500 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);
510503}
511504
512505SILType SILType::subst (TypeConverter &tc, SubstitutionMap subs) const {
@@ -521,7 +514,7 @@ SILType SILType::subst(SILModule &M, SubstitutionMap subs) const{
521514
522515SILType SILType::subst (SILModule &M, SubstitutionMap subs,
523516 TypeExpansionContext context) const {
524- if (isSubstitutionInvariant (*this , false ))
517+ if (isSubstitutionInvariant (*this , None ))
525518 return *this ;
526519
527520 InFlightSubstitutionViaSubMap IFS (subs, None);
0 commit comments