Skip to content

Commit 491defb

Browse files
committed
[Sema] TypeWrappers: Mark $_storage as private and all $Storage properties as internal
1 parent 3aa2bb9 commit 491defb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: lib/Sema/TypeCheckTypeWrapper.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ using namespace swift;
2828
/// Create a property declaration and inject it into the given type.
2929
static VarDecl *injectProperty(NominalTypeDecl *parent, Identifier name,
3030
Type type, VarDecl::Introducer introducer,
31+
AccessLevel accessLevel,
3132
Expr *initializer = nullptr) {
3233
auto &ctx = parent->getASTContext();
3334

@@ -36,7 +37,7 @@ static VarDecl *injectProperty(NominalTypeDecl *parent, Identifier name,
3637

3738
var->setImplicit();
3839
var->setSynthesized();
39-
var->copyFormalAccessFrom(parent, /*sourceIsParentContext=*/true);
40+
var->setAccess(accessLevel);
4041
var->setInterfaceType(type);
4142

4243
Pattern *pattern = NamedPattern::createImplicit(ctx, var);
@@ -193,8 +194,8 @@ GetTypeWrapperProperty::evaluate(Evaluator &evaluator,
193194
typeWrapper, /*Parent=*/typeWrapperType->getParent(),
194195
/*genericArgs=*/{storage->getInterfaceType()->getMetatypeInstanceType()});
195196

196-
return injectProperty(parent, ctx.Id_TypeWrapperProperty,
197-
propertyTy, VarDecl::Introducer::Var);
197+
return injectProperty(parent, ctx.Id_TypeWrapperProperty, propertyTy,
198+
VarDecl::Introducer::Var, AccessLevel::Private);
198199
}
199200

200201
VarDecl *GetTypeWrapperStorageForProperty::evaluate(Evaluator &evaluator,
@@ -215,7 +216,7 @@ VarDecl *GetTypeWrapperStorageForProperty::evaluate(Evaluator &evaluator,
215216

216217
return injectProperty(storage, property->getName(),
217218
property->getValueInterfaceType(),
218-
property->getIntroducer());
219+
property->getIntroducer(), AccessLevel::Internal);
219220
}
220221

221222
/// Given the property create a subscript to reach its type wrapper storage:

0 commit comments

Comments
 (0)