Files
swift-mirror/test/ModuleInterface/static-initialize-objc-metadata-attr.swift
Becca Royal-Gordon 1f008fb0d0 [ModuleInterface] Enable module selectors by default
And update tests to use them.

This commit depends on fixes in swiftlang/swift PRs #86905, #87129, and #87130.

Fixes rdar://169749886.
2026-02-20 00:35:23 -08:00

25 lines
925 B
Swift

// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Module -target %target-pre-stable-abi-triple
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Module
// RUN: %FileCheck %s < %t.swiftinterface
// REQUIRES: objc_interop
import Foundation
// To infer @_staticInitializeObjCMetadata, the following needs to be true
// Our class needs to be:
// - A subclass of a generic Objective-C class
// - That inherits a conformance to a protocol
// - Declared in a module with a deployment target before the stable ABI
public class Super<T>: NSObject, NSCoding {
required public init(coder: NSCoder) {}
public func encode(with: NSCoder) {}
}
// CHECK-NOT: @_staticInitializeObjCMetadata
// CHECK: public class Sub : Module::Super<Swift::Int>
public class Sub: Super<Int> {
required public init(coder: NSCoder) {}
override public func encode(with: NSCoder) {}
}