Skip to content

Access control improvements #17252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -1325,15 +1325,15 @@ ERROR(unsupported_nested_protocol,none,
// Type aliases
ERROR(type_alias_underlying_type_access,none,
"type alias %select{must be declared %select{"
"%select{private|fileprivate|internal|%error|%error}2|private or fileprivate}3"
"%select{private|fileprivate|internal|%error|%error}1|private or fileprivate}3"
"|cannot be declared "
"%select{in this context|fileprivate|internal|public|open}1}0 "
"because its underlying type uses "
"%select{a private|a fileprivate|an internal|%error|%error}2 type",
(bool, AccessLevel, AccessLevel, bool))
WARNING(type_alias_underlying_type_access_warn,none,
"type alias %select{should be declared "
"%select{private|fileprivate|internal|%error|%error}2"
"%select{private|fileprivate|internal|%error|%error}1"
"|should not be declared "
"%select{in this context|fileprivate|internal|public|open}1}0 "
"because its underlying type uses "
Expand All @@ -1351,7 +1351,7 @@ ERROR(subscript_type_access,none,
(bool, AccessLevel, AccessLevel, bool))
WARNING(subscript_type_access_warn,none,
"subscript %select{should be declared "
"%select{private|fileprivate|internal|%error|%error}2"
"%select{private|fileprivate|internal|%error|%error}1"
"|should not be declared %select{in this context|fileprivate|internal|public|open}1}0 "
"because its %select{index|element type}3 uses "
"%select{a private|a fileprivate|an internal|%error|%error}2 type",
Expand All @@ -1369,7 +1369,7 @@ ERROR(function_type_access,none,
(bool, AccessLevel, bool, AccessLevel, unsigned, bool))
WARNING(function_type_access_warn,none,
"%select{function|method|initializer}4 "
"%select{should be declared %select{private|fileprivate|internal|%error|%error}3"
"%select{should be declared %select{private|fileprivate|internal|%error|%error}1"
"|should not be declared %select{in this context|fileprivate|internal|public|open}1}0 "
"because its %select{parameter|result}5 uses "
"%select{a private|a fileprivate|an internal|%error|%error}3 type",
Expand Down Expand Up @@ -1565,20 +1565,22 @@ NOTE(witness_fix_access,none,
"mark the %0 as '%select{%error|fileprivate|internal|public|%error}1' to "
"satisfy the requirement", (DescriptiveDeclKind, AccessLevel))

ERROR(protocol_refine_access,none,
ERROR(protocol_access,none,
"%select{protocol must be declared %select{"
"%select{private|fileprivate|internal|%error|%error}2"
"|private or fileprivate}3 because it refines"
"%select{private|fileprivate|internal|%error|%error}1"
"|private or fileprivate}4 because %select{it refines|its 'where' clause uses}2"
"|%select{in this context|fileprivate|internal|public|%error}1 "
"protocol cannot refine}0 "
"%select{a private|a fileprivate|an internal|%error|%error}2 protocol",
(bool, AccessLevel, AccessLevel, bool))
WARNING(protocol_refine_access_warn,none,
"%select{protocol cannot refine|protocol's 'where' clause cannot use}2}0 "
"%select{a private|a fileprivate|an internal|%error|%error}3 protocol",
(bool, AccessLevel, bool, AccessLevel, bool))
WARNING(protocol_access_warn,none,
"%select{protocol should be declared "
"%select{private|fileprivate|internal|%error|%error}2 because it refines"
"|%select{in this context|fileprivate|internal|public|%error}1 protocol should not "
"refine}0 %select{a private|a fileprivate|an internal|%error|%error}2 protocol",
(bool, AccessLevel, AccessLevel, bool))
"%select{private|fileprivate|internal|%error|%error}1 because "
"%select{it refines|its 'where' clause uses}2"
"|%select{in this context|fileprivate|internal|public|%error}1 "
"%select{protocol should not refine|protocol's 'where' clause should not use}2}0 "
"%select{a private|a fileprivate|an internal|%error|%error}3 protocol",
(bool, AccessLevel, bool, AccessLevel, bool))
ERROR(protocol_property_must_be_computed_var,none,
"immutable property requirement must be declared as 'var' with a "
"'{ get }' specifier", ())
Expand Down Expand Up @@ -2122,15 +2124,15 @@ NOTE(enum_declares_rawrep_with_raw_type,none,
"%0 declares raw type %1, which implies RawRepresentable", (Type, Type))
ERROR(enum_raw_type_access,none,
"enum %select{must be declared %select{"
"%select{private|fileprivate|internal|%error|%error}2|private or fileprivate}3"
"%select{private|fileprivate|internal|%error|%error}1|private or fileprivate}3"
"|cannot be declared "
"%select{in this context|fileprivate|internal|public|open}1}0 "
"because its raw type uses "
"%select{a private|a fileprivate|an internal|%error|%error}2 type",
(bool, AccessLevel, AccessLevel, bool))
WARNING(enum_raw_type_access_warn,none,
"enum %select{should be declared "
"%select{private|fileprivate|internal|%error|%error}2"
"%select{private|fileprivate|internal|%error|%error}1"
"|should not be declared %select{in this context|fileprivate|internal|public|open}1}0 "
"because its raw type uses "
"%select{a private|a fileprivate|an internal|%error|%error}2 type",
Expand Down Expand Up @@ -3238,7 +3240,7 @@ ERROR(bool_intrinsics_not_found,none,
"broken standard library: cannot find intrinsic operations on Bool", ())
ERROR(class_super_access,none,
"class %select{must be declared %select{"
"%select{private|fileprivate|internal|%error|%error}2|private or fileprivate}3"
"%select{private|fileprivate|internal|%error|%error}1|private or fileprivate}3"
"|cannot be declared %select{in this context|fileprivate|internal|public|open}1}0 "
"because its superclass "
"%select{is %select{private|fileprivate|internal|%error|%error}2"
Expand All @@ -3247,7 +3249,7 @@ ERROR(class_super_access,none,
(bool, AccessLevel, AccessLevel, bool, bool))
WARNING(class_super_access_warn,none,
"class %select{should be declared "
"%select{private|fileprivate|internal|%error|%error}2"
"%select{private|fileprivate|internal|%error|%error}1"
"|should not be declared %select{in this context|fileprivate|internal|public|open}1}0 "
"because its superclass "
"%select{is %select{private|fileprivate|internal|%error|%error}2"
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/SubstitutionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ void SubstitutionMap::verify() const {
substType->dump();
llvm::dbgs() << "SubstitutionMap:\n";
dump(llvm::dbgs());
llvm::errs() << "\n";
llvm::dbgs() << "\n";
}

assert(proto->isObjC() &&
Expand All @@ -634,7 +634,7 @@ void SubstitutionMap::verify() const {
substType->dump(llvm::dbgs());
llvm::dbgs() << "SubstitutionMap:\n";
dump(llvm::dbgs());
llvm::errs() << "\n";
llvm::dbgs() << "\n";
}
assert(conformance.isConcrete() && "Conformance should be concrete");

Expand Down
Loading