Always disable requiring Foundation for '@objc' when building/typechecking interfaces

This commit is contained in:
Artem Chikin
2023-10-02 10:26:07 -07:00
parent 1c8f2954e7
commit 08533c94ec
2 changed files with 18 additions and 0 deletions

View File

@@ -735,6 +735,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
OPT_disable_testable_attr_requires_testable_module)) {
Opts.EnableTestableAttrRequiresTestableModule
= A->getOption().matches(OPT_enable_testable_attr_requires_testable_module);
} else if (FrontendOpts.RequestedAction ==
FrontendOptions::ActionType::TypecheckModuleFromInterface ||
FrontendOpts.RequestedAction ==
FrontendOptions::ActionType::CompileModuleFromInterface) {
Opts.EnableObjCAttrRequiresFoundation = false;
}
if (Args.getLastArg(OPT_debug_cycles))

View File

@@ -0,0 +1,13 @@
// swift-interface-format-version: 1.0
// swift-module-flags: -module-name ExplicitInterfaceObjC
// REQUIRES: objc_interop, OS=macosx
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -compile-module-from-interface -module-name ExplicitInterfaceObjC -explicit-interface-module-build -o %/t/ExplicitInterfaceObjC.swiftmodule %s -verify
// RUN: %target-swift-frontend -typecheck-module-from-interface -module-name ExplicitInterfaceObjC -explicit-interface-module-build -o %/t/ExplicitInterfaceObjC.swiftmodule %s -verify
import Swift
final public class Foo {
@objc deinit
}