|
| 1 | +// swift-interface-format-version: 1.0 |
| 2 | +// swift-compiler-version: Swift version 5.0 |
| 3 | +// swift-module-flags: |
| 4 | + |
| 5 | +// RUN: %empty-directory(%t) |
| 6 | +// RUN: not %target-swift-frontend -typecheck-module-from-interface -module-name Broken %s 2>%t/interface-verification-errors.txt |
| 7 | +// RUN: %FileCheck %s < %t/interface-verification-errors.txt |
| 8 | + |
| 9 | +import Swift |
| 10 | + |
| 11 | +// This type is meant to shadow the name of the module, creating an ambiguity. |
| 12 | +public struct Broken {} |
| 13 | + |
| 14 | +public struct BrokenOptions : Swift.OptionSet { |
| 15 | + public let rawValue: Swift.Int |
| 16 | + public static let none: Broken.BrokenOptions |
| 17 | + public static let anOption: Broken.BrokenOptions |
| 18 | + public init(rawValue: Swift.Int) |
| 19 | + public typealias ArrayLiteralElement = Broken.BrokenOptions |
| 20 | + public typealias Element = Broken.BrokenOptions |
| 21 | + public typealias RawValue = Swift.Int |
| 22 | +} |
| 23 | + |
| 24 | +// CHECK: error: 'BrokenOptions' is not a member type of struct 'Broken.Broken' |
| 25 | +// CHECK: error: 'BrokenOptions' is not a member type of struct 'Broken.Broken' |
| 26 | +// CHECK: error: 'BrokenOptions' is not a member type of struct 'Broken.Broken' |
| 27 | +// CHECK: error: 'BrokenOptions' is not a member type of struct 'Broken.Broken' |
| 28 | + |
| 29 | +// CHECK: error: type 'BrokenOptions' does not conform to protocol 'OptionSet' |
| 30 | +// CHECK: error: type 'BrokenOptions' does not conform to protocol 'SetAlgebra' |
| 31 | +// CHECK: note: candidate would match if 'BrokenOptions.Element' was the same type as 'τ_0_0.Element' |
| 32 | +// CHECK: error: type 'BrokenOptions' does not conform to protocol 'ExpressibleByArrayLiteral' |
| 33 | +// CHECK: note: protocol requires nested type 'Element'; do you want to add it? |
| 34 | +// CHECK: note: protocol requires initializer 'init(_:)' with type 'S' |
| 35 | +// CHECK: note: protocol requires nested type 'ArrayLiteralElement'; do you want to add it? |
| 36 | +// CHECK: error: failed to verify module interface of 'Broken' due to the errors above; the textual interface may be broken by project issues, differences between compilers |
0 commit comments