Skip to content

Commit 3dd74c1

Browse files
committed
Remove evaluator::getScopeForAccessLevel
1 parent 934f994 commit 3dd74c1

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

include/swift/AST/EvaluatorDependencies.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,38 +66,6 @@ enum class DependencyScope : bool {
6666
Cascading = true,
6767
};
6868

69-
/// Returns a \c DependencyScope appropriate for the given (formal) access level.
70-
///
71-
/// :warning: This function exists to bridge the old manual reference
72-
/// dependencies code to the new evaluator-based reference dependencies code.
73-
/// The manual code often made private/cascading scope judgements based on the
74-
/// access level of a declaration. While this makes some sense intuitively, it
75-
/// does not necessarily capture an accurate picture of where real incremental
76-
/// dependencies lie. For example, references to formally private types can
77-
/// "escape" to contexts that have no reference to the private name if, say,
78-
/// the layout of that private type is taken into consideration by
79-
/// SILGen or IRGen in a separate file that references the declaration
80-
/// transitively. However, due to the density of the current dependency
81-
/// graph, redundancy in registered dependency edges, and the liberal use of
82-
/// cascading edges, we may be saved from the worst consequences of this
83-
/// modelling choice.
84-
///
85-
/// The use of access-levels for dependency decisions is an anti-pattern that
86-
/// should be revisited once finer-grained dependencies are explored more
87-
/// thoroughly.
88-
inline DependencyScope getScopeForAccessLevel(AccessLevel l) {
89-
switch (l) {
90-
case AccessLevel::Private:
91-
case AccessLevel::FilePrivate:
92-
return DependencyScope::Private;
93-
case AccessLevel::Internal:
94-
case AccessLevel::Public:
95-
case AccessLevel::Open:
96-
return DependencyScope::Cascading;
97-
}
98-
llvm_unreachable("invalid access level kind");
99-
}
100-
10169
// A \c DependencySource is currently defined to be a parent source file and
10270
// an associated dependency scope.
10371
//

lib/AST/NameLookupRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ evaluator::DependencySource InheritedProtocolsRequest::readDependencySource(
9999
return { nullptr, e.getActiveSourceScope() };
100100
return {
101101
e.getActiveDependencySourceOrNull(),
102-
evaluator::getScopeForAccessLevel(PD->getFormalAccess())
102+
DependencyScope::Private,
103103
};
104104
}
105105

lib/AST/TypeCheckRequests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ evaluator::DependencySource SuperclassTypeRequest::readDependencySource(
162162
const auto access = std::get<0>(getStorage())->getFormalAccess();
163163
return {
164164
e.getActiveDependencySourceOrNull(),
165-
evaluator::getScopeForAccessLevel(access)
165+
evaluator::DependencyScope::Private,
166166
};
167167
}
168168

@@ -1289,7 +1289,7 @@ evaluator::DependencySource CheckRedeclarationRequest::readDependencySource(
12891289
auto *currentDC = current->getDeclContext();
12901290
return {
12911291
currentDC->getParentSourceFile(),
1292-
evaluator::getScopeForAccessLevel(current->getFormalAccess())
1292+
evaluator::DependencyScope::Private,
12931293
};
12941294
}
12951295

@@ -1329,7 +1329,7 @@ LookupAllConformancesInContextRequest::readDependencySource(
13291329
}
13301330

13311331
return {collector.getActiveDependencySourceOrNull(),
1332-
evaluator::getScopeForAccessLevel(nominal->getFormalAccess())};
1332+
evaluator::DependencyScope::Private};
13331333
}
13341334

13351335
void LookupAllConformancesInContextRequest::writeDependencySink(

0 commit comments

Comments
 (0)