@@ -42,15 +42,6 @@ enum class DowngradeToWarning: bool {
42
42
Yes
43
43
};
44
44
45
- // / A uniquely-typed boolean to reduce the chances of accidentally inverting
46
- // / a check.
47
- // /
48
- // / \see checkTypeAccessImpl
49
- enum class FromSPI : bool {
50
- No,
51
- Yes
52
- };
53
-
54
45
// / Calls \p callback for each type in each requirement provided by
55
46
// / \p source.
56
47
static void forAllRequirementTypes (
@@ -87,7 +78,7 @@ class AccessControlCheckerBase {
87
78
88
79
void checkTypeAccessImpl (
89
80
Type type, TypeRepr *typeRepr, AccessScope contextAccessScope,
90
- const DeclContext *useDC, bool mayBeInferred, FromSPI fromSPI,
81
+ const DeclContext *useDC, bool mayBeInferred,
91
82
llvm::function_ref<CheckTypeAccessCallback> diagnose);
92
83
93
84
void checkTypeAccess (
@@ -109,7 +100,7 @@ class AccessControlCheckerBase {
109
100
llvm::function_ref<CheckTypeAccessCallback> diagnose) {
110
101
forAllRequirementTypes (std::move (source), [&](Type type, TypeRepr *typeRepr) {
111
102
checkTypeAccessImpl (type, typeRepr, accessScope, useDC,
112
- /* mayBeInferred*/ false , FromSPI::No, diagnose);
103
+ /* mayBeInferred*/ false , diagnose);
113
104
});
114
105
}
115
106
@@ -196,12 +187,9 @@ class TypeAccessScopeDiagnoser : private ASTWalker {
196
187
// / using `Array` to mean `Array<Element>` in an extension of Array.) If
197
188
// / \p typeRepr is known to be absent, it's okay to pass \c false for
198
189
// / \p mayBeInferred.
199
- // /
200
- // / If searching from an SPI context, pass \c FromSPI::YES for \p fromSPI.
201
- // / In this mode, all types must be public and diagnostic messages are adapted.
202
190
void AccessControlCheckerBase::checkTypeAccessImpl (
203
191
Type type, TypeRepr *typeRepr, AccessScope contextAccessScope,
204
- const DeclContext *useDC, bool mayBeInferred, FromSPI fromSPI,
192
+ const DeclContext *useDC, bool mayBeInferred,
205
193
llvm::function_ref<CheckTypeAccessCallback> diagnose) {
206
194
207
195
auto &Context = useDC->getASTContext ();
@@ -310,9 +298,8 @@ void AccessControlCheckerBase::checkTypeAccess(
310
298
context->getFormalAccessScope (
311
299
context->getDeclContext (), checkUsableFromInline);
312
300
313
- auto fromSPI = static_cast <FromSPI>(context->isSPI ());
314
301
checkTypeAccessImpl (type, typeRepr, contextAccessScope, DC, mayBeInferred,
315
- fromSPI, diagnose);
302
+ diagnose);
316
303
}
317
304
318
305
// / Highlights the given TypeRepr, and adds a note pointing to the type's
@@ -372,10 +359,6 @@ void AccessControlCheckerBase::checkGenericParamAccess(
372
359
};
373
360
374
361
auto *DC = ownerDecl->getDeclContext ();
375
- auto fromSPI = FromSPI::No;
376
- if (auto ownerValueDecl = dyn_cast<ValueDecl>(ownerDecl)) {
377
- fromSPI = static_cast <FromSPI>(ownerValueDecl->isSPI ());
378
- }
379
362
380
363
for (auto param : *params) {
381
364
if (param->getInherited ().empty ())
@@ -384,7 +367,7 @@ void AccessControlCheckerBase::checkGenericParamAccess(
384
367
checkTypeAccessImpl (param->getInherited ().front ().getType (),
385
368
param->getInherited ().front ().getTypeRepr (),
386
369
accessScope, DC, /* mayBeInferred*/ false ,
387
- fromSPI, callback);
370
+ callback);
388
371
}
389
372
callbackACEK = ACEK::Requirement;
390
373
@@ -1496,7 +1479,7 @@ class ExportabilityChecker : public DeclVisitor<ExportabilityChecker> {
1496
1479
bool foundAnyIssues = false ;
1497
1480
1498
1481
// Check the TypeRepr first (if present), because that will give us a
1499
- // better diagonstic .
1482
+ // better diagnostic .
1500
1483
if (typeRepr) {
1501
1484
const_cast <TypeRepr *>(typeRepr)->walk (TypeReprIdentFinder (
1502
1485
[&](const ComponentIdentTypeRepr *component) {
0 commit comments