Skip to content

Commit 7e733c4

Browse files
committed
RequirementMachine: compiler_crashers_2_fixed/0074-rdar28544316.swift now type checks; move it to test/Generics/
1 parent d4a4540 commit 7e733c4

File tree

2 files changed

+48
-38
lines changed

2 files changed

+48
-38
lines changed

test/Generics/rdar28544316.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
}

validation-test/compiler_crashers_2_fixed/0074-rdar28544316.swift

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)