Skip to content

Commit 052da16

Browse files
committed
sema: avoid diagnosing typed_throw_in_objc_forbidden in textual interface files
PR #81054 introduced diagnostics for that @objc function shouldn't be using typed throws. Emitting this fatal diagnostics in Swift textual interface files seems to be redundant because (1) it should be already diagnosed in the source code, and (2) downstream clients have no control over the contents of upstream textual interfaces. rdar://162138214
1 parent 95358e8 commit 052da16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ bool swift::isRepresentableInLanguage(
846846
}
847847

848848
// Check that @objc functions can't have typed throw.
849-
if (AFD->hasThrows()) {
849+
if (!AFD->getDeclContext()->isInSwiftinterface() && AFD->hasThrows()) {
850850
Type thrownType = AFD->getThrownInterfaceType();
851851
// TODO: only `throws(Error)` is allowed.
852852
// Throwing `any MyError` that confronts `Error` is not implemented yet.

0 commit comments

Comments
 (0)