Files
swift-mirror/test/Generics/missing_sendable_conformance.swift
Slava Pestov 9170378d25 RequirementMachine: Fix handling of Sendable conformances for superclass requirements
Don't set allowMissing to true when checking conformance of a superclass requirement
to a protocol, since this prevents us from being able to express something like
'T : C, T : Sendable' to mean 'T can be any subclass of C which is also Sendable'.

Fixes rdar://problem/91530343.
2022-04-11 14:52:32 -04:00

35 lines
1.1 KiB
Swift

// RUN: %target-typecheck-verify-swift
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
// REQUIRES: concurrency
// rdar://91174106 - allow missing Sendable conformances when extending a
// type generically.
// FIXME: Should warn because of missing Sendable, but currently is silent
// because we aren't checking conformance availability here yet.
class C {}
struct G1<T: Sendable> {}
// CHECK-LABEL: ExtensionDecl line={{.*}} base=G1
// CHECK-NEXT: Generic signature: <T where T == C>
extension G1 where T == C {}
// CHECK-LABEL: ExtensionDecl line={{.*}} base=G1
// CHECK-NEXT: Generic signature: <T where T : C, T : Sendable>
extension G1 where T : C {}
protocol P {
associatedtype A
}
struct G2<T : P> where T.A : Sendable {}
// CHECK-LABEL: ExtensionDecl line={{.*}} base=G2
// CHECK-NEXT: Generic signature: <T where T : P, T.[P]A == C>
extension G2 where T.A == C {}
// CHECK-LABEL: ExtensionDecl line={{.*}} base=G2
// CHECK-NEXT: Generic signature: <T where T : P, T.[P]A : C, T.[P]A : Sendable>
extension G2 where T.A : C {}