@@ -1009,6 +1009,7 @@ static Type substOpaqueTypesWithUnderlyingTypesRec(
1009
1009
// / opaque substitutions are or are not allowed.
1010
1010
static bool canSubstituteTypeInto (Type ty, const DeclContext *dc,
1011
1011
OpaqueSubstitutionKind kind,
1012
+ ResilienceExpansion contextExpansion,
1012
1013
bool isContextWholeModule) {
1013
1014
TypeDecl *typeDecl = ty->getAnyNominal ();
1014
1015
if (!typeDecl) {
@@ -1049,7 +1050,8 @@ static bool canSubstituteTypeInto(Type ty, const DeclContext *dc,
1049
1050
1050
1051
case OpaqueSubstitutionKind::SubstituteNonResilientModule:
1051
1052
// Can't access types that are not public from a different module.
1052
- if (dc->getParentModule () == typeDecl->getDeclContext ()->getParentModule ())
1053
+ if (dc->getParentModule () == typeDecl->getDeclContext ()->getParentModule () &&
1054
+ contextExpansion != ResilienceExpansion::Minimal)
1053
1055
return typeDecl->getEffectiveAccess () > AccessLevel::FilePrivate;
1054
1056
1055
1057
return typeDecl->getEffectiveAccess () > AccessLevel::Internal;
@@ -1093,10 +1095,13 @@ operator()(SubstitutableType *maybeOpaqueType) const {
1093
1095
// context.
1094
1096
auto inContext = this ->getContext ();
1095
1097
auto isContextWholeModule = this ->isWholeModule ();
1098
+ auto contextExpansion = this ->contextExpansion ;
1096
1099
if (inContext &&
1097
1100
partialSubstTy.findIf (
1098
- [inContext, substitutionKind, isContextWholeModule](Type t) -> bool {
1101
+ [inContext, substitutionKind, isContextWholeModule,
1102
+ contextExpansion](Type t) -> bool {
1099
1103
if (!canSubstituteTypeInto (t, inContext, substitutionKind,
1104
+ contextExpansion,
1100
1105
isContextWholeModule))
1101
1106
return true ;
1102
1107
return false ;
@@ -1204,9 +1209,12 @@ operator()(CanType maybeOpaqueType, Type replacementType,
1204
1209
// context.
1205
1210
auto inContext = this ->getContext ();
1206
1211
auto isContextWholeModule = this ->isWholeModule ();
1212
+ auto contextExpansion = this ->contextExpansion ;
1207
1213
if (partialSubstTy.findIf (
1208
- [inContext, substitutionKind, isContextWholeModule](Type t) -> bool {
1214
+ [inContext, substitutionKind, isContextWholeModule,
1215
+ contextExpansion](Type t) -> bool {
1209
1216
if (!canSubstituteTypeInto (t, inContext, substitutionKind,
1217
+ contextExpansion,
1210
1218
isContextWholeModule))
1211
1219
return true ;
1212
1220
return false ;
0 commit comments