Skip to content

RequirementMachine: Add a couple of passing protocol minimization test cases #40457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions test/Generics/rdar77683844.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s

// CHECK-LABEL: rdar77683844.(file).P1@
// CHECK-LABEL: Requirement signature: <Self where Self.T1 : P2, Self.T1 == Self.T3.T1, Self.T2 == Self.T1.T2, Self.T3 == Self.T1.T3, Self.T1.T2 == Self.T1.T4.T2, Self.T1.T3 == Self.T2.T3>

public protocol P1 {
associatedtype T1: P2 where T1.T4.T2 == T2, T1.T2 == T2, T1.T3 == T3
associatedtype T2 where T2.T3 == T3
associatedtype T3 where T3.T1 == T1
}

// CHECK-LABEL: rdar77683844.(file).P2@
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4, Self.T3 : P3, Self.T4 : P5>

public protocol P2 {
associatedtype T3: P3
associatedtype T2: P4
associatedtype T4: P5
}

// CHECK-LABEL: rdar77683844.(file).P3@
// CHECK-LABEL: Requirement signature: <Self where Self.T1 : P2, Self.T2 : P4>

public protocol P3 {
associatedtype T1: P2
associatedtype T2: P4
}

// CHECK-LABEL: rdar77683844.(file).P4@
// CHECK-LABEL: Requirement signature: <Self where Self.T3 : P3>

public protocol P4 {
associatedtype T3: P3
}

// CHECK-LABEL: rdar77683844.(file).P5@
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>

public protocol P5 {
associatedtype T2: P4
}
29 changes: 29 additions & 0 deletions test/Generics/rdar78233378.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s

// CHECK-LABEL: rdar78233378.(file).P1@
// CHECK-LABEL: Requirement signature: <Self where Self : P4, Self == Self.T1.T2, Self.T1 : P2>
public protocol P1: P4 where T1.T2 == Self {
associatedtype T1: P2
}

// CHECK-LABEL: rdar78233378.(file).P2@
// CHECK-LABEL: Requirement signature: <Self where Self : P5, Self.T2 : P1>
public protocol P2: P5 where T2: P1 {}

// CHECK-LABEL: rdar78233378.(file).P3@
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>
public protocol P3 {
associatedtype T2: P4
}

// CHECK-LABEL: rdar78233378.(file).P4@
// CHECK-LABEL: Requirement signature: <Self where Self == Self.T3.T2, Self.T3 : P3>
public protocol P4 where T3.T2 == Self {
associatedtype T3: P3
}

// CHECK-LABEL: rdar78233378.(file).P5@
// CHECK-LABEL: Requirement signature: <Self where Self.T2 : P4>
public protocol P5 {
associatedtype T2: P4
}