|
| 1 | +// RUN: %target-swift-frontend -typecheck %s -disable-availability-checking -debug-generic-signatures 2>&1 | %FileCheck %s |
| 2 | + |
| 3 | +public protocol View { |
| 4 | + associatedtype Body : View |
| 5 | + var body: Body { get } |
| 6 | +} |
| 7 | + |
| 8 | +public struct Text : View { |
| 9 | + public init(_: String) {} |
| 10 | + public var body: Self { return self } |
| 11 | +} |
| 12 | + |
| 13 | +public protocol DisplayableValue {} |
| 14 | + |
| 15 | +public protocol SingleValueDisplay: View { |
| 16 | + associatedtype DisplayedValue |
| 17 | + init (_ singleValue: DisplayedValue) |
| 18 | + var displayedValue: DisplayedValue { get } |
| 19 | +} |
| 20 | + |
| 21 | +// CHECK-LABEL: .RawDisplayableValue@ |
| 22 | +// CHECK-NEXT: Requirement signature: <Self where Self : DisplayableValue, Self == Self.[RawDisplayableValue]RawDisplay.[SingleValueDisplay]DisplayedValue, Self.[RawDisplayableValue]RawDisplay : SingleValueDisplay> |
| 23 | +public protocol RawDisplayableValue: DisplayableValue { |
| 24 | + associatedtype RawDisplay: SingleValueDisplay |
| 25 | + where RawDisplay.DisplayedValue == Self |
| 26 | +} |
| 27 | + |
| 28 | +// CHECK-LABEL: .RawTextDisplayableValue@ |
| 29 | +// CHECK-NEXT: Requirement signature: <Self where Self : CustomStringConvertible, Self : RawDisplayableValue, Self.[RawDisplayableValue]RawDisplay == RawTextDisplay<Self>> |
| 30 | +public protocol RawTextDisplayableValue: RawDisplayableValue |
| 31 | + where Self: CustomStringConvertible, |
| 32 | + RawDisplay == RawTextDisplay<Self> { } |
| 33 | + |
| 34 | +public struct RawTextDisplay <Value: CustomStringConvertible>: SingleValueDisplay { |
| 35 | + public var displayedValue: Value |
| 36 | + |
| 37 | + public init (_ singleValue: Value) { |
| 38 | + self.displayedValue = singleValue |
| 39 | + } |
| 40 | + |
| 41 | + public var body: some View { |
| 42 | + Text(displayedValue.description) |
| 43 | + } |
| 44 | +} |
0 commit comments