Skip to content

Commit f08c7a8

Browse files
committed
Revert "Fix a Family of Crashers in Availability Checking"
This reverts commit ae711a7.
1 parent cdfb483 commit f08c7a8

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,7 @@ static void computeExportContextBits(ASTContext &Ctx, Decl *D,
147147
if (D->isSPI())
148148
*spi = true;
149149

150-
// Defer bodies are desugared to an implicit closure expression. We need to
151-
// dilute the meaning of "implicit" to make sure we're still checking
152-
// availability inside of defer statements.
153-
const auto isDeferBody = isa<FuncDecl>(D) && cast<FuncDecl>(D)->isDeferBody();
154-
if (D->isImplicit() && !isDeferBody)
150+
if (D->isImplicit())
155151
*implicit = true;
156152

157153
if (D->getAttrs().getDeprecated(Ctx))

test/Sema/availability.swift

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -195,32 +195,3 @@ struct VarToFunc {
195195
}
196196
}
197197

198-
struct DeferBody {
199-
func foo() {
200-
enum No: Error {
201-
case no
202-
}
203-
204-
defer {
205-
do {
206-
throw No.no
207-
} catch No.no {
208-
} catch {
209-
}
210-
}
211-
_ = ()
212-
}
213-
214-
func bar() {
215-
@available(*, unavailable)
216-
enum No: Error { // expected-note 2 {{'No' has been explicitly marked unavailable here}}
217-
case no
218-
}
219-
do {
220-
throw No.no
221-
// expected-error@-1 {{'No' is unavailable}}
222-
} catch No.no {} catch _ {}
223-
// expected-error@-1 {{'No' is unavailable}}
224-
}
225-
}
226-

test/attr/attr_inlinable.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,3 @@ public struct PrivateInlinableCrash {
357357
// expected-error@-2 {{initializer 'init()' is private and cannot be referenced from an '@inlinable' function}}
358358
}
359359
}
360-
361-
// Just make sure we don't crash.
362-
private func deferBodyTestCall() {} // expected-note {{global function 'deferBodyTestCall()' is not '@usableFromInline' or public}}
363-
@inlinable public func deferBodyTest() {
364-
defer {
365-
deferBodyTestCall() // expected-error {{global function 'deferBodyTestCall()' is private and cannot be referenced from an '@inlinable' function}}
366-
}
367-
_ = ()
368-
}

0 commit comments

Comments
 (0)