Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/NameLookup/Inputs/MemberImportVisibility/members_A.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ public protocol ProtocolInA {
extension ProtocolInA {
public func defaultedRequirementInA() { }
}

public struct EquatableInA: Equatable {
public static func ==(_: Self, _: Self) -> Bool {
false
}
}
6 changes: 6 additions & 0 deletions test/NameLookup/Inputs/MemberImportVisibility/members_B.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ open class DerivedClassInB: BaseClassInA {
extension ProtocolInA {
public func defaultedRequirementInB() { }
}

public struct EquatableInB: Equatable {
public static func ==(_: EquatableInB, _: EquatableInB) -> Bool {
false
}
}
12 changes: 12 additions & 0 deletions test/NameLookup/Inputs/MemberImportVisibility/members_C.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ open class DerivedClassInC: DerivedClassInB {
extension ProtocolInA {
public func defaultedRequirementInC() { }
}

public struct EquatableInC: Equatable {
public static func ==(_: EquatableInC, _: EquatableInC) -> Bool {
false
}
}

public struct HasEquatableMembers {
public var a: EquatableInA
public var b: EquatableInB
public var c: EquatableInC
}
11 changes: 11 additions & 0 deletions test/NameLookup/member_import_visibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,14 @@ func testLeadingDotSyntax() {
takesP(.zInC)
takesP(.zAmbiguous)
}

func testConformanceMember(_ h1: HasEquatableMembers, _ h2: HasEquatableMembers) {
_ = h1.a == h2.a
// Technically, this references the EquatableInB.== member that hasn't been
// imported. However, the conformance of EquatableInB: Equatable is visible
// here because conformances are not yet subject to import visibility rules.
// As a result, the == requirement is technically visible and therefore there
// should be no diagnostic with MemberImportVisibility enabled.
_ = h1.b == h2.b
_ = h1.c == h2.c
}