Skip to content

Commit 78341b9

Browse files
committed
Always disable requiring Foundation for '@objc' when building/typechecking interfaces
1 parent ff980ef commit 78341b9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
730730
OPT_disable_testable_attr_requires_testable_module)) {
731731
Opts.EnableTestableAttrRequiresTestableModule
732732
= A->getOption().matches(OPT_enable_testable_attr_requires_testable_module);
733+
} else if (FrontendOpts.RequestedAction ==
734+
FrontendOptions::ActionType::TypecheckModuleFromInterface ||
735+
FrontendOpts.RequestedAction ==
736+
FrontendOptions::ActionType::CompileModuleFromInterface) {
737+
Opts.EnableObjCAttrRequiresFoundation = false;
733738
}
734739

735740
if (Args.getLastArg(OPT_debug_cycles))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-module-flags: -module-name ExplicitInterfaceObjC
3+
4+
// REQUIRES: objc_interop, OS=macosx
5+
// RUN: %empty-directory(%t)
6+
7+
// RUN: %target-swift-frontend -compile-module-from-interface -module-name ExplicitInterfaceObjC -explicit-interface-module-build -o %/t/ExplicitInterfaceObjC.swiftmodule %s -verify
8+
// RUN: %target-swift-frontend -typecheck-module-from-interface -module-name ExplicitInterfaceObjC -explicit-interface-module-build -o %/t/ExplicitInterfaceObjC.swiftmodule %s -verify
9+
import Swift
10+
11+
final public class Foo {
12+
@objc deinit
13+
}

0 commit comments

Comments
 (0)