@@ -3181,15 +3181,12 @@ operator()(SubstitutableType *maybeOpaqueType) const {
3181
3181
// archetype in question. This will map the inner generic signature of the
3182
3182
// opaque type to its outer signature.
3183
3183
auto partialSubstTy = archetype->getInterfaceType ().subst (*subs);
3184
- // Then apply the substitutions from the root opaque archetype, to specialize
3185
- // for its type arguments.
3186
- auto substTy = partialSubstTy.subst (opaqueRoot->getSubstitutions ());
3187
3184
3188
3185
// Check that we are allowed to substitute the underlying type into the
3189
3186
// context.
3190
3187
auto inContext = this ->inContext ;
3191
3188
auto isContextWholeModule = this ->isContextWholeModule ;
3192
- if (substTy .findIf (
3189
+ if (partialSubstTy .findIf (
3193
3190
[inContext, substitutionKind, isContextWholeModule](Type t) -> bool {
3194
3191
if (!canSubstituteTypeInto (t, inContext, substitutionKind,
3195
3192
isContextWholeModule))
@@ -3198,6 +3195,12 @@ operator()(SubstitutableType *maybeOpaqueType) const {
3198
3195
}))
3199
3196
return maybeOpaqueType;
3200
3197
3198
+ // Then apply the substitutions from the root opaque archetype, to specialize
3199
+ // for its type arguments. We perform this substitution after checking for
3200
+ // visibility, since we do not want the result of the visibility check to
3201
+ // depend on the substitutions previously applied.
3202
+ auto substTy = partialSubstTy.subst (opaqueRoot->getSubstitutions ());
3203
+
3201
3204
// If the type changed, but still contains opaque types, recur.
3202
3205
if (!substTy->isEqual (maybeOpaqueType) && substTy->hasOpaqueArchetype ()) {
3203
3206
return ::substOpaqueTypesWithUnderlyingTypes (
@@ -3264,18 +3267,12 @@ operator()(CanType maybeOpaqueType, Type replacementType,
3264
3267
// archetype in question. This will map the inner generic signature of the
3265
3268
// opaque type to its outer signature.
3266
3269
auto partialSubstTy = archetype->getInterfaceType ().subst (*subs);
3267
- auto partialSubstRef =
3268
- abstractRef.subst (archetype->getInterfaceType (), *subs);
3269
-
3270
- // Then apply the substitutions from the root opaque archetype, to specialize
3271
- // for its type arguments.
3272
- auto substTy = partialSubstTy.subst (opaqueRoot->getSubstitutions ());
3273
3270
3274
3271
// Check that we are allowed to substitute the underlying type into the
3275
3272
// context.
3276
3273
auto inContext = this ->inContext ;
3277
3274
auto isContextWholeModule = this ->isContextWholeModule ;
3278
- if (substTy .findIf (
3275
+ if (partialSubstTy .findIf (
3279
3276
[inContext, substitutionKind, isContextWholeModule](Type t) -> bool {
3280
3277
if (!canSubstituteTypeInto (t, inContext, substitutionKind,
3281
3278
isContextWholeModule))
@@ -3284,6 +3281,14 @@ operator()(CanType maybeOpaqueType, Type replacementType,
3284
3281
}))
3285
3282
return abstractRef;
3286
3283
3284
+ // Then apply the substitutions from the root opaque archetype, to specialize
3285
+ // for its type arguments. We perform this substitution after checking for
3286
+ // visibility, since we do not want the result of the visibility check to
3287
+ // depend on the substitutions previously applied.
3288
+ auto substTy = partialSubstTy.subst (opaqueRoot->getSubstitutions ());
3289
+
3290
+ auto partialSubstRef =
3291
+ abstractRef.subst (archetype->getInterfaceType (), *subs);
3287
3292
auto substRef =
3288
3293
partialSubstRef.subst (partialSubstTy, opaqueRoot->getSubstitutions ());
3289
3294
@@ -4879,6 +4884,17 @@ case TypeKind::Id:
4879
4884
if (resultTy.getPointer () != function->getResult ().getPointer ())
4880
4885
isUnchanged = false ;
4881
4886
4887
+ // Transform the global actor.
4888
+ Type globalActorType;
4889
+ if (Type origGlobalActorType = function->getGlobalActor ()) {
4890
+ globalActorType = origGlobalActorType.transformRec (fn);
4891
+ if (!globalActorType)
4892
+ return Type ();
4893
+
4894
+ if (globalActorType.getPointer () != origGlobalActorType.getPointer ())
4895
+ isUnchanged = false ;
4896
+ }
4897
+
4882
4898
if (auto genericFnType = dyn_cast<GenericFunctionType>(base)) {
4883
4899
#ifndef NDEBUG
4884
4900
// Check that generic parameters won't be trasnformed.
@@ -4895,15 +4911,17 @@ case TypeKind::Id:
4895
4911
if (!function->hasExtInfo ())
4896
4912
return GenericFunctionType::get (genericSig, substParams, resultTy);
4897
4913
return GenericFunctionType::get (genericSig, substParams, resultTy,
4898
- function->getExtInfo ());
4914
+ function->getExtInfo ()
4915
+ .withGlobalActor (globalActorType));
4899
4916
}
4900
4917
4901
4918
if (isUnchanged) return *this ;
4902
4919
4903
4920
if (!function->hasExtInfo ())
4904
4921
return FunctionType::get (substParams, resultTy);
4905
4922
return FunctionType::get (substParams, resultTy,
4906
- function->getExtInfo ());
4923
+ function->getExtInfo ()
4924
+ .withGlobalActor (globalActorType));
4907
4925
}
4908
4926
4909
4927
case TypeKind::ArraySlice: {
0 commit comments