Skip to content

Commit bd9d1a3

Browse files
committed
Minor fixes for Fix-Its of conditional conformances and a test case
1 parent 8ee72c9 commit bd9d1a3

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ static void diagnoseConformanceImpliedByConditionalConformance(
20632063
auto proto = conformance->getProtocol();
20642064
Type protoType = proto->getDeclaredInterfaceType();
20652065
auto implyingProto = implyingConf->getProtocol()->getDeclaredInterfaceType();
2066-
auto loc = implyingConf->getLoc();
2066+
auto loc = extractNearestSourceLoc(implyingConf->getDeclContext());
20672067
Diags.diagnose(loc, diag::conditional_conformances_cannot_imply_conformances,
20682068
conformance->getType(), implyingProto, protoType);
20692069

test/APINotes/versioned-objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import APINotesFrameworkTest
99

1010
// CHECK-DIAGS-5-NOT: versioned-objc.swift:[[@LINE-1]]:
1111
class ProtoWithVersionedUnavailableMemberImpl: ProtoWithVersionedUnavailableMember {
12-
// CHECK-DIAGS-4: versioned-objc.swift:[[@LINE-1]]:7: error: type 'ProtoWithVersionedUnavailableMemberImpl' cannot conform to protocol 'ProtoWithVersionedUnavailableMember' because it has requirements that cannot be satisfied
12+
// CHECK-DIAGS-4: versioned-objc.swift:[[@LINE-1]]:48: error: type 'ProtoWithVersionedUnavailableMemberImpl' cannot conform to protocol 'ProtoWithVersionedUnavailableMember' because it has requirements that cannot be satisfied
1313
func requirement() -> Any? { return nil }
1414
}
1515

test/Distributed/distributed_protocol_isolation.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ protocol StrictlyLocal {
106106
}
107107

108108
distributed actor Nope1_StrictlyLocal: StrictlyLocal {
109+
// expected-note@-1{{add '@preconcurrency' to the 'StrictlyLocal' conformance to suppress isolation-related diagnostics}}
110+
109111
func local() {}
110112
// expected-error@-1{{distributed actor-isolated instance method 'local()' cannot be used to satisfy nonisolated protocol requirement}}
111113
// expected-note@-2{{add 'nonisolated' to 'local()' to make this instance method not isolated to the actor}}
@@ -157,6 +159,8 @@ actor LocalOK_ImplicitlyThrowsAsync_AsyncThrowsAll: AsyncThrowsAll {
157159
}
158160

159161
distributed actor Nope1_AsyncThrowsAll: AsyncThrowsAll {
162+
// expected-note@-1{{add '@preconcurrency' to the 'AsyncThrowsAll' conformance to suppress isolation-related diagnostics}}
163+
160164
func maybe(param: String, int: Int) async throws -> Int { 111 }
161165
// expected-error@-1{{distributed actor-isolated instance method 'maybe(param:int:)' cannot be used to satisfy nonisolated protocol requirement}}
162166
// expected-note@-2{{add 'nonisolated' to 'maybe(param:int:)' to make this instance method not isolated to the actor}}
@@ -202,6 +206,8 @@ func test_watching_A(a: A_TerminationWatchingA) async throws {
202206
}
203207

204208
distributed actor DA_TerminationWatchingA: TerminationWatchingA {
209+
// expected-note@-1{{add '@preconcurrency' to the 'TerminationWatchingA' conformance to suppress isolation-related diagnostics}}
210+
205211
func terminated(a: String) { }
206212
// expected-error@-1{{distributed actor-isolated instance method 'terminated(a:)' cannot be used to satisfy nonisolated protocol requirement}}
207213
// expected-note@-2{{add 'nonisolated' to 'terminated(a:)' to make this instance method not isolated to the actor}}

0 commit comments

Comments
 (0)