Skip to content

Commit 63b02ff

Browse files
committed
[Sema] Remove checks preventing metatype keypaths in Sema.
1 parent 4368125 commit 63b02ff

File tree

3 files changed

+0
-17
lines changed

3 files changed

+0
-17
lines changed

include/swift/Sema/CSFix.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,8 +2007,6 @@ class TreatKeyPathSubscriptIndexAsHashable final : public ConstraintFix {
20072007

20082008
class AllowInvalidRefInKeyPath final : public ConstraintFix {
20092009
enum RefKind {
2010-
// Allow a reference to a static member as a key path component.
2011-
StaticMember,
20122010
// Allow a reference to a declaration with mutating getter as
20132011
// a key path component.
20142012
MutatingGetter,
@@ -2032,8 +2030,6 @@ class AllowInvalidRefInKeyPath final : public ConstraintFix {
20322030
public:
20332031
std::string getName() const override {
20342032
switch (Kind) {
2035-
case RefKind::StaticMember:
2036-
return "allow reference to a static member as a key path component";
20372033
case RefKind::MutatingGetter:
20382034
return "allow reference to a member with mutating getter as a key "
20392035
"path component";

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5286,9 +5286,6 @@ namespace {
52865286
auto varDecl = cast<VarDecl>(property);
52875287
// Key paths don't work with mutating-get properties.
52885288
assert(!varDecl->isGetterMutating());
5289-
// Key paths don't currently support static members.
5290-
// There is a fix which diagnoses such situation already.
5291-
assert(!varDecl->isStatic());
52925289

52935290
// Compute the concrete reference to the member.
52945291
auto ref = resolveConcreteDeclRef(property, locator);

lib/Sema/CSFix.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,11 +1205,6 @@ TreatKeyPathSubscriptIndexAsHashable::create(ConstraintSystem &cs, Type type,
12051205
bool AllowInvalidRefInKeyPath::diagnose(const Solution &solution,
12061206
bool asNote) const {
12071207
switch (Kind) {
1208-
case RefKind::StaticMember: {
1209-
InvalidStaticMemberRefInKeyPath failure(solution, Member, getLocator());
1210-
return failure.diagnose(asNote);
1211-
}
1212-
12131208
case RefKind::EnumCase: {
12141209
InvalidEnumCaseRefInKeyPath failure(solution, Member, getLocator());
12151210
return failure.diagnose(asNote);
@@ -1273,11 +1268,6 @@ AllowInvalidRefInKeyPath::forRef(ConstraintSystem &cs, ValueDecl *member,
12731268
return AllowInvalidRefInKeyPath::create(cs, RefKind::Initializer,
12741269
member, locator);
12751270

1276-
// Referencing static members in key path is not currently allowed.
1277-
if (member->isStatic())
1278-
return AllowInvalidRefInKeyPath::create(cs, RefKind::StaticMember, member,
1279-
locator);
1280-
12811271
if (auto *storage = dyn_cast<AbstractStorageDecl>(member)) {
12821272
// Referencing members with mutating getters in key path is not
12831273
// currently allowed.

0 commit comments

Comments
 (0)