// RUN: %empty-directory(%t) // Test with -enable-module-selectors-in-module-interface // RUN: %empty-directory(%t/enabled) // RUN: %target-swift-emit-module-interface(%t/enabled/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -enable-module-selectors-in-module-interface 2>%t/enabled/stderr.txt // RUN: %FileCheck --input-file %t/enabled/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-ENABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/enabled/stderr.txt %s --allow-empty --check-prefix DIAG-PRESERVE-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/enabled/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -disable-module-selectors-in-module-interface // RUN: %empty-directory(%t/disabled) // RUN: %target-swift-emit-module-interface(%t/disabled/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -disable-module-selectors-in-module-interface 2>%t/disabled/stderr.txt // RUN: %FileCheck --input-file %t/disabled/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-DISABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/disabled/stderr.txt %s --allow-empty --check-prefix DIAG-PRESERVE-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/disabled/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test default behavior // RUN: %empty-directory(%t/default) // RUN: %target-swift-emit-module-interface(%t/default/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase 2>%t/default/stderr.txt // RUN: %FileCheck --input-file %t/default/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-ENABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/default/stderr.txt %s --allow-empty --check-prefix DIAG-PRESERVE-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/default/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -enable-module-selectors-in-module-interface and blocklist // RUN: %empty-directory(%t/blocked) // RUN: %target-swift-emit-module-interface(%t/blocked/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -enable-module-selectors-in-module-interface -blocklist-file %S/Inputs/module_selector/blocklist.yml 2>%t/blocked/stderr.txt // RUN: %FileCheck --input-file %t/blocked/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-DISABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/blocked/stderr.txt %s --allow-empty --check-prefix DIAG-PRESERVE-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/blocked/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -module-interface-preserve-types-as-written and -disable-module-selectors-in-module-interface // RUN: %empty-directory(%t/disabled-preserve) // RUN: %target-swift-emit-module-interface(%t/disabled-preserve/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -module-interface-preserve-types-as-written -disable-module-selectors-in-module-interface 2>%t/disabled-preserve/stderr.txt // RUN: %FileCheck --input-file %t/disabled-preserve/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-PRESERVE,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/disabled-preserve/stderr.txt %s --allow-empty --check-prefix DIAG-PRESERVE-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/disabled-preserve/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -module-interface-preserve-types-as-written and -enable-module-selectors-in-module-interface // RUN: %empty-directory(%t/enabled-preserve) // RUN: %target-swift-emit-module-interface(%t/enabled-preserve/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -module-interface-preserve-types-as-written -enable-module-selectors-in-module-interface 2>%t/enabled-preserve/stderr.txt // RUN: %FileCheck --input-file %t/enabled-preserve/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-ENABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/enabled-preserve/stderr.txt %s --check-prefix DIAG-PRESERVE-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/enabled-preserve/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -module-interface-preserve-types-as-written and -alias-module-names-in-module-interface // RUN: %empty-directory(%t/disabled-alias) // RUN: %target-swift-emit-module-interface(%t/disabled-alias/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -alias-module-names-in-module-interface -disable-module-selectors-in-module-interface 2>%t/disabled-alias/stderr.txt // RUN: %FileCheck --input-file %t/disabled-alias/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-ALIAS // RUN: %FileCheck --input-file %t/disabled-alias/stderr.txt %s --allow-empty --check-prefix DIAG-ALIAS-NOT-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/disabled-alias/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // Test with -module-interface-preserve-types-as-written and -alias-module-names-in-module-interface // RUN: %empty-directory(%t/enabled-alias) // RUN: %target-swift-emit-module-interface(%t/enabled-alias/TestCase.swiftinterface) %s %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase -alias-module-names-in-module-interface -enable-module-selectors-in-module-interface 2>%t/enabled-alias/stderr.txt // RUN: %FileCheck --input-file %t/enabled-alias/TestCase.swiftinterface %s --check-prefixes CHECK,CHECK-ENABLED,CHECK-NOT-ALIAS // RUN: %FileCheck --input-file %t/enabled-alias/stderr.txt %s --check-prefix DIAG-ALIAS-OVERRIDDEN // RUN: %target-swift-typecheck-module-from-interface(%t/enabled-alias/TestCase.swiftinterface) %clang-importer-sdk -F %clang-importer-sdk-path/frameworks -I %S/Inputs/module_selector -target %target-stable-abi-triple -module-name TestCase // CHECK-NOT-ALIAS: import enums_using_attributes // CHECK-ALIAS: import Module___enums_using_attributes import enums_using_attributes // CHECK-LABEL: public struct Struct : // CHECK-ENABLED-SAME: Swift::Hashable where T : Swift::Hashable { // CHECK-DISABLED-SAME: Swift.Hashable where T : Swift.Hashable { // CHECK-PRESERVE-SAME: Hashable where T : Swift.Hashable { // Preserve quirk: Hashable qualified in constraint? // CHECK-ALIAS-SAME: Swift.Hashable where T : Swift.Hashable { public struct Struct: Hashable { // CHECK: public let integer: // CHECK-ENABLED-SAME: Swift::Int // CHECK-DISABLED-SAME: Swift.Int // CHECK-PRESERVE-SAME: Int // CHECK-ALIAS-SAME: Swift.Int public let integer: Int = 42 // CHECK: public let enumeration: // CHECK-ENABLED-SAME: enums_using_attributes::CFEnumWithAttr // CHECK-DISABLED-SAME: enums_using_attributes.CFEnumWithAttr // CHECK-PRESERVE-SAME: CFEnumWithAttr // CHECK-ALIAS-SAME: Module___enums_using_attributes.CFEnumWithAttr public let enumeration: CFEnumWithAttr = CFEnumWithAttr.first // CHECK: public let t: T? public let t: T? = nil // CHECK: public static func == // CHECK-ENABLED-SAME: (a: TestCase::Struct, b: TestCase::Struct) -> Swift::Bool // CHECK-DISABLED-SAME: (a: TestCase.Struct, b: TestCase.Struct) -> Swift.Bool // CHECK-PRESERVE-SAME: (a: TestCase.Struct, b: TestCase.Struct) -> Swift.Bool // CHECK-ALIAS-SAME: (a: Module___TestCase.Struct, b: Module___TestCase.Struct) -> Swift.Bool // CHECK: public func hash // CHECK-ENABLED-SAME: (into hasher: inout Swift::Hasher) // CHECK-DISABLED-SAME: (into hasher: inout Swift.Hasher) // CHECK-PRESERVE-SAME: (into hasher: inout Swift.Hasher) // CHECK-ALIAS-SAME: (into hasher: inout Swift.Hasher) // CHECK: public var hashValue: // CHECK-ENABLED-SAME: Swift::Int { // CHECK-DISABLED-SAME: Swift.Int { // CHECK-PRESERVE-SAME: Swift.Int { // CHECK-ALIAS-SAME: Swift.Int { // CHECK: } } // CHECK-ENABLED: extension TestCase::Struct { // CHECK-DISABLED: extension TestCase.Struct { // CHECK-PRESERVE: extension Struct { // CHECK-ALIAS: extension Module___TestCase.Struct { extension Struct { // CHECK-LABEL: public enum Nested { public enum Nested { // CHECK: case integer // CHECK-ENABLED-SAME: (Swift::Int) // CHECK-DISABLED-SAME: (Swift.Int) // CHECK-PRESERVE-SAME: (Int) // CHECK-ALIAS-SAME: (Swift.Int) case integer(Int) // CHECK: case enumeration // CHECK-ENABLED-SAME: (enums_using_attributes::CFEnumWithAttr) // CHECK-DISABLED-SAME: (enums_using_attributes.CFEnumWithAttr) // CHECK-PRESERVE-SAME: (CFEnumWithAttr) // CHECK-ALIAS-SAME: (Module___enums_using_attributes.CFEnumWithAttr) case enumeration(CFEnumWithAttr) // CHECK: case t(T) case t(T) // CHECK: case `struct` // CHECK-ENABLED-SAME: (TestCase::Struct) // CHECK-DISABLED-SAME: (TestCase.Struct) // CHECK-PRESERVE-SAME: (Struct) // CHECK-ALIAS-SAME: (Module___TestCase.Struct) case `struct`(Struct) // CHECK: } } // CHECK: } } // CHECK-ENABLED: extension Swift::Int { // CHECK-DISABLED: extension Swift.Int { // CHECK-PRESERVE: extension Int { // Preserve quirk: Int has no module selector? // CHECK-ALIAS: extension Swift.Int { extension Swift::Int { // CHECK-LABEL: public enum RetroactiveNested { public enum RetroactiveNested {} } // CHECK-ENABLED: extension Swift::Int.TestCase::RetroactiveNested { // CHECK-DISABLED: extension Swift.Int.RetroactiveNested { // CHECK-PRESERVE: extension Int.RetroactiveNested { // CHECK-ALIAS: extension Swift.Int.RetroactiveNested { extension Int.RetroactiveNested { public func anchor() {} } // CHECK-LABEL: public func fn // CHECK-ENABLED-SAME: (_: TestCase::Struct, _: TestCase::Struct.TestCase::Nested) // CHECK-DISABLED-SAME: (_: TestCase.Struct, _: TestCase.Struct.Nested) // CHECK-PRESERVE-SAME: (_: Struct, _: Struct.Nested) // CHECK-ALIAS-SAME: (_: Module___TestCase.Struct, _: Module___TestCase.Struct.Nested) public func fn(_: Struct, _: Struct.Nested) {} // CHECK-LABEL: public func fn2 // CHECK-ENABLED-SAME: (_: T) where T : Swift::Identifiable, T.ID == TestCase::Struct // CHECK-DISABLED-SAME: (_: T) where T : Swift.Identifiable, T.ID == TestCase.Struct // CHECK-PRESERVE-SAME: (_: T) where T : Swift.Identifiable, T.ID == TestCase.Struct // Preserve quirk: Still qualified in constraints? // CHECK-ALIAS-SAME: (_: T) where T : Swift.Identifiable, T.ID == Module___TestCase.Struct @available(SwiftStdlib 5.1, *) public func fn2(_: T) where T.ID == Struct {} // CHECK-LABEL: public protocol Proto { @available(SwiftStdlib 5.1, *) public protocol Proto { // CHECK: associatedtype AssocType : // CHECK-ENABLED-SAME: Swift::Identifiable // CHECK-DISABLED-SAME: Swift.Identifiable // CHECK-PRESERVE-SAME: Identifiable // CHECK-ALIAS-SAME: Swift.Identifiable associatedtype AssocType: Identifiable // CHECK: typealias TypeAlias = // CHECK-ENABLED-SAME: TestCase::Struct // CHECK-DISABLED-SAME: TestCase.Struct // CHECK-PRESERVE-SAME: Struct // CHECK-ALIAS-SAME: Module___TestCase.Struct typealias TypeAlias = Struct // CHECK: typealias ID = // CHECK-ENABLED-SAME: Self.AssocType.ID // CHECK-DISABLED-SAME: Self.AssocType.ID // CHECK-PRESERVE-SAME: AssocType.ID // CHECK-ALIAS-SAME: Self.AssocType.ID typealias ID = AssocType.ID // CHECK: func requirement() -> // CHECK-ENABLED-SAME: Self.AssocType.ID // CHECK-DISABLED-SAME: Self.AssocType.ID // CHECK-PRESERVE-SAME: AssocType.ID // CHECK-ALIAS-SAME: Self.AssocType.ID func requirement() -> AssocType.ID // CHECK: func requirement2() -> // CHECK-ENABLED-SAME: Self.TypeAlias.Nested // CHECK-DISABLED-SAME: Self.TypeAlias.Nested // CHECK-PRESERVE-SAME: TypeAlias.Nested // CHECK-ALIAS-SAME: Self.TypeAlias.Nested func requirement2() -> TypeAlias.Nested // CHECK: } } @available(SwiftStdlib 5.1, *) extension Proto { public typealias Text = String } // Test cases from rdar://166180424 // CHECK-LABEL: func fn3(_ t: T) -> // CHECK-SAME: T.TypeAlias.Nested @available(SwiftStdlib 5.1, *) public func fn3(_ t: T) -> T.TypeAlias.Nested { fatalError() } // CHECK-LABEL: struct ProtoSet @available(SwiftStdlib 5.1, *) public struct ProtoSet { // CHECK: let ids: // CHECK-ENABLED-SAME: Swift::Set // CHECK-DISABLED-SAME: Swift.Set // CHECK-PRESERVE-SAME: Set // CHECK-ALIAS-SAME: Swift.Set public let ids: Set // CHECK: let texts: // CHECK-ENABLED-SAME: Swift::Set // CHECK-DISABLED-SAME: Swift.Set // CHECK-PRESERVE-SAME: Set // CHECK-ALIAS-SAME: Swift.Set public let texts: Set // CHECK: let singleText: // CHECK-SAME: T.Text public let singleText: T.Text } // rdar://169720990 -- complicated protocol hierarchy with typealias in protocol // CHECK-LABEL: class TypeAliasNestClass public final class TypeAliasNestClass: TypeAliasNestProtocol { // CHECK: typealias AssociatedType4 = // CHECK-ENABLED-SAME: TestCase::TypeAliasNestClass.AssociatedType1.AssociatedType4 // CHECK-DISABLED-SAME: TestCase.TypeAliasNestClass.AssociatedType1.AssociatedType4 // CHECK-PRESERVE-SAME: AssociatedType1.AssociatedType4 // CHECK-ALIAS-SAME: Module___TestCase.TypeAliasNestClass.AssociatedType1.AssociatedType4 public typealias AssociatedType4 = AssociatedType1.AssociatedType4 public typealias AssociatedType1 = GenericParam.AssociatedType1 } public protocol TypeAliasNestProtocol { associatedtype AssociatedType1: AssociatedType1Protocol } public protocol AssociatedType1Protocol { associatedtype AssociatedType2: AssociatedType2Protocol typealias AssociatedType4 = AssociatedType2.AssociatedType3.AssociatedType4 } public protocol AssociatedType2Protocol { associatedtype AssociatedType3: AssociatedType3Protocol } public protocol AssociatedType3Protocol { associatedtype AssociatedType4 } // DIAG-PRESERVE-OVERRIDDEN: warning: ignoring '-module-interface-preserve-types-as-written'; this option has been obsoleted by module selectors (add '-disable-module-selectors-in-module-interface' to restore original behavior) // DIAG-PRESERVE-NOT-OVERRIDDEN-NOT: warning: ignoring '-module-interface-preserve-types-as-written'; this option has been obsoleted by module selectors (add '-disable-module-selectors-in-module-interface' to restore original behavior) // DIAG-ALIAS-OVERRIDDEN: warning: ignoring '-alias-module-names-in-module-interface'; this option has been obsoleted by module selectors (add '-disable-module-selectors-in-module-interface' to restore original behavior) // DIAG-ALIAS-NOT-OVERRIDDEN-NOT: warning: ignoring '-alias-module-names-in-module-interface'; this option has been obsoleted by module selectors (add '-disable-module-selectors-in-module-interface' to restore original behavior)