Skip to content

Commit eea8a9d

Browse files
authored
Merge pull request #58548 from apple/revert-58487-rdar-92364955-5.7
Revert "[5.7][ConstraintSystem] Extend availability check to cover unavailable ext…"
2 parents 5aa05b2 + 0d3c63e commit eea8a9d

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6266,7 +6266,7 @@ void ConstraintSystem::diagnoseFailureFor(SolutionApplicationTarget target) {
62666266
bool ConstraintSystem::isDeclUnavailable(const Decl *D,
62676267
ConstraintLocator *locator) const {
62686268
// First check whether this declaration is universally unavailable.
6269-
if (AvailableAttr::isUnavailable(D))
6269+
if (D->getAttrs().isUnavailable(getASTContext()))
62706270
return true;
62716271

62726272
return TypeChecker::isDeclarationUnavailable(D, DC, [&] {

test/Constraints/availability.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,3 @@ func unavailableFunction(_ x: Int) -> Bool { true } // expected-note {{'unavaila
4343
func sr13260(_ arr: [Int]) {
4444
for x in arr where unavailableFunction(x) {} // expected-error {{'unavailableFunction' is unavailable}}
4545
}
46-
47-
// rdar://92364955 - ambiguity with member declared in unavailable extension
48-
struct WithUnavailableExt {
49-
}
50-
51-
@available(*, unavailable)
52-
extension WithUnavailableExt {
53-
static var foo: WithUnavailableExt = WithUnavailableExt()
54-
}
55-
56-
func test_no_ambiguity_with_unavailable_ext() {
57-
struct A {
58-
static var foo: A = A()
59-
}
60-
61-
struct Test {
62-
init(_: A) {}
63-
init(_: WithUnavailableExt) {}
64-
}
65-
66-
_ = Test(.foo) // Ok `A.foo` since `foo` from `WithUnavailableExt` is unavailable
67-
}

0 commit comments

Comments
 (0)