Skip to content

Commit 8133161

Browse files
committed
[ParseableInterface] Don't require Foundation to use @objc
Deinitializers are always @objc. (Arguably, this makes it unnecessary to print, but we don't want to do any @objc inference at all in a swiftinterface.)
1 parent a51f1dd commit 8133161

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/Frontend/ParseableInterfaceSupport.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ ParseableInterfaceModuleLoader::configureSubInvocationAndOutputPaths(
157157
// by making them non-fatal).
158158
SubInvocation.getLangOptions().DebuggerSupport = LangOpts.DebuggerSupport;
159159

160+
// Disable this; deinitializers always get printed with `@objc` even in
161+
// modules that don't import Foundation.
162+
SubInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
163+
160164
// Calculate an output filename that includes a hash of relevant key data, and
161165
// wire up the SubInvocation's InputsAndOutputs to contain both input and
162166
// output filenames.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-module-flags: -module-name ObjCAttrWithoutFoundation -enable-resilience -enable-objc-interop
3+
4+
// RUN: %empty-directory(%t)
5+
// RUN: echo 'import ObjCAttrWithoutFoundation' | %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S -
6+
7+
public class MyClass {
8+
public init()
9+
@objc deinit
10+
}

0 commit comments

Comments
 (0)