|
| 1 | +// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=on |
| 2 | +// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s |
| 3 | + |
| 4 | +public class OFMAttachment : NativeInserting { |
| 5 | +// expected-warning@-1 {{non-final class 'OFMAttachment' cannot safely conform to protocol 'NativeInserting', which requires that 'Self.SnapshotType.NativeType' is exactly equal to 'Self'; this is an error in Swift 6}} |
| 6 | + public typealias SnapshotType = Message.Attachment |
| 7 | +} |
| 8 | + |
| 9 | +// CHECK-LABEL: .Snapshotting@ |
| 10 | +// CHECK-NEXT: Requirement signature: <Self where Self == Self.[Snapshotting]ChangeType.[SnapshotChange]SnapshotType, Self.[Snapshotting]ChangeType : SnapshotChange, Self.[Snapshotting]NativeType : NativeInserting, Self.[Snapshotting]RecordType : SnapshotRecord, Self.[Snapshotting]ChangeType.[SnapshotChange]SnapshotType == Self.[Snapshotting]NativeType.[NativeInserting]SnapshotType, Self.[Snapshotting]NativeType.[NativeInserting]SnapshotType == Self.[Snapshotting]RecordType.[SnapshotRecord]SnapshotType> |
| 11 | +public protocol Snapshotting { |
| 12 | + associatedtype NativeType: NativeInserting where NativeType.SnapshotType == Self |
| 13 | + associatedtype RecordType: SnapshotRecord where RecordType.SnapshotType == Self |
| 14 | + associatedtype ChangeType: SnapshotChange where ChangeType.SnapshotType == Self |
| 15 | + |
| 16 | + static var baseMessageName: String { get } |
| 17 | +} |
| 18 | + |
| 19 | +// CHECK-LABEL: .NativeInserting@ |
| 20 | +// CHECK-NEXT: Requirement signature: <Self where Self == Self.[NativeInserting]SnapshotType.[Snapshotting]NativeType, Self.[NativeInserting]SnapshotType : Snapshotting> |
| 21 | +public protocol NativeInserting { |
| 22 | + associatedtype SnapshotType : Snapshotting where SnapshotType.NativeType == Self |
| 23 | +} |
| 24 | + |
| 25 | +// CHECK-LABEL: .SnapshotRecord@ |
| 26 | +// CHECK-NEXT: Requirement signature: <Self where Self == Self.[SnapshotRecord]SnapshotType.[Snapshotting]RecordType, Self.[SnapshotRecord]SnapshotType : Snapshotting> |
| 27 | +public protocol SnapshotRecord { |
| 28 | + associatedtype SnapshotType : Snapshotting where SnapshotType.RecordType == Self |
| 29 | + |
| 30 | +} |
| 31 | + |
| 32 | +// CHECK-LABEL: .SnapshotChange@ |
| 33 | +// CHECK-NEXT: Requirement signature: <Self where Self == Self.[SnapshotChange]SnapshotType.[Snapshotting]ChangeType, Self.[SnapshotChange]SnapshotType : Snapshotting> |
| 34 | +public protocol SnapshotChange { |
| 35 | + associatedtype SnapshotType : Snapshotting where SnapshotType.ChangeType == Self |
| 36 | +} |
| 37 | + |
| 38 | +public struct Message { |
| 39 | + public enum Attachment : Snapshotting { |
| 40 | + |
| 41 | + public static var baseMessageName: String = "attachment" |
| 42 | + |
| 43 | + public typealias NativeType = OFMAttachment |
| 44 | + public typealias RecordType = Record |
| 45 | + public typealias ChangeType = Change |
| 46 | + public struct Record : SnapshotRecord { |
| 47 | + public typealias SnapshotType = Message.Attachment |
| 48 | + } |
| 49 | + |
| 50 | + public struct Change : SnapshotChange { |
| 51 | + public typealias SnapshotType = Message.Attachment |
| 52 | + } |
| 53 | + |
| 54 | + } |
| 55 | +} |
| 56 | + |
0 commit comments