|
| 1 | +// RUN: %target-swift-frontend %s -emit-ir -debug-generic-signatures -requirement-machine-inferred-signatures=on 2>&1 | %FileCheck %s |
| 2 | +// REQUIRES: asserts |
| 3 | + |
| 4 | +class PropertyDataSource<O: PropertyHosting> { |
| 5 | +} |
| 6 | + |
| 7 | +protocol TableViewCellFactoryType { |
| 8 | + associatedtype Item |
| 9 | +} |
| 10 | + |
| 11 | +public protocol PropertyHosting { |
| 12 | + associatedtype PType: Hashable, EntityOwned |
| 13 | +} |
| 14 | + |
| 15 | +public protocol EntityOwned: class { |
| 16 | + associatedtype Owner |
| 17 | +} |
| 18 | + |
| 19 | +public protocol PropertyType: class { |
| 20 | +} |
| 21 | + |
| 22 | +func useType<T>(cellType: T.Type) { |
| 23 | +} |
| 24 | + |
| 25 | +// The GSB would reject this declaration because it was "too minimal", |
| 26 | +// missing the Factory.Item : EntityOwned requirement that is |
| 27 | +// required to get a conformance-valid rewrite system. |
| 28 | +// |
| 29 | +// The Requirement Machine correctly infers this requirement and adds |
| 30 | +// it during minimization. |
| 31 | + |
| 32 | +// CHECK-LABEL: rdar28544316.(file).PropertyTableViewAdapter@ |
| 33 | +// CHECK-NEXT: Generic signature: <Factory where Factory : TableViewCellFactoryType, Factory.[TableViewCellFactoryType]Item : EntityOwned, Factory.[TableViewCellFactoryType]Item : PropertyType, Factory.[TableViewCellFactoryType]Item == Factory.[TableViewCellFactoryType]Item.[EntityOwned]Owner.[PropertyHosting]PType, Factory.[TableViewCellFactoryType]Item.[EntityOwned]Owner : PropertyHosting> |
| 34 | + |
| 35 | +final class PropertyTableViewAdapter<Factory: TableViewCellFactoryType> |
| 36 | + where |
| 37 | + Factory.Item: PropertyType, |
| 38 | + Factory.Item.Owner: PropertyHosting, |
| 39 | + Factory.Item.Owner.PType == Factory.Item |
| 40 | +{ |
| 41 | + typealias Item = Factory.Item |
| 42 | + |
| 43 | + let dataManager: PropertyDataSource<Factory.Item.Owner> |
| 44 | + init(dataManager: PropertyDataSource<Factory.Item.Owner>) { |
| 45 | + useType(cellType: Factory.Item.Owner.self) |
| 46 | + self.dataManager = dataManager |
| 47 | + } |
| 48 | +} |
0 commit comments