File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
Inputs/MemberImportVisibility Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -79,3 +79,9 @@ public protocol ProtocolInA {
7979extension ProtocolInA {
8080 public func defaultedRequirementInA( ) { }
8181}
82+
83+ public struct EquatableInA : Equatable {
84+ public static func == ( _: Self , _: Self ) -> Bool {
85+ false
86+ }
87+ }
Original file line number Diff line number Diff line change @@ -59,3 +59,9 @@ open class DerivedClassInB: BaseClassInA {
5959extension ProtocolInA {
6060 public func defaultedRequirementInB( ) { }
6161}
62+
63+ public struct EquatableInB : Equatable {
64+ public static func == ( _: EquatableInB , _: EquatableInB ) -> Bool {
65+ false
66+ }
67+ }
Original file line number Diff line number Diff line change @@ -52,3 +52,15 @@ open class DerivedClassInC: DerivedClassInB {
5252extension ProtocolInA {
5353 public func defaultedRequirementInC( ) { }
5454}
55+
56+ public struct EquatableInC : Equatable {
57+ public static func == ( _: EquatableInC , _: EquatableInC ) -> Bool {
58+ false
59+ }
60+ }
61+
62+ public struct HasEquatableMembers {
63+ public var a : EquatableInA
64+ public var b : EquatableInB
65+ public var c : EquatableInC
66+ }
Original file line number Diff line number Diff line change @@ -167,3 +167,14 @@ func testLeadingDotSyntax() {
167167 takesP ( . zInC)
168168 takesP ( . zAmbiguous)
169169}
170+
171+ func testConformanceMember( _ h1: HasEquatableMembers , _ h2: HasEquatableMembers ) {
172+ _ = h1. a == h2. a
173+ // Technically, this references the EquatableInB.== member that hasn't been
174+ // imported. However, the conformance of EquatableInB: Equatable is visible
175+ // here because conformances are not yet subject to import visibility rules.
176+ // As a result, the == requirement is technically visible and therefore there
177+ // should be no diagnostic with MemberImportVisibility enabled.
178+ _ = h1. b == h2. b
179+ _ = h1. c == h2. c
180+ }
You can’t perform that action at this time.
0 commit comments