Skip to content

Commit bc4ab29

Browse files
authored
Merge pull request #68913 from artemcm/NoObjCRequiresFoundationInInterfaceTypecheck
Always disable requiring Foundation for '@objc' when building/typechecking interfaces
2 parents f4a0397 + 08533c9 commit bc4ab29

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
@@ -735,6 +735,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
735735
OPT_disable_testable_attr_requires_testable_module)) {
736736
Opts.EnableTestableAttrRequiresTestableModule
737737
= A->getOption().matches(OPT_enable_testable_attr_requires_testable_module);
738+
} else if (FrontendOpts.RequestedAction ==
739+
FrontendOptions::ActionType::TypecheckModuleFromInterface ||
740+
FrontendOpts.RequestedAction ==
741+
FrontendOptions::ActionType::CompileModuleFromInterface) {
742+
Opts.EnableObjCAttrRequiresFoundation = false;
738743
}
739744

740745
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)