Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0115-sr5601.swift
Doug Gregor bebac49cee [GSB] Form minimal requirement sources by removing redundant subpaths.
When we detect that a requirement source is self-derived, identify the
redundant subpath and remove it to produce a new, smaller requirement
source that computes the same result. We were doing this form the
limited case where the redundant subpath ended at the end of the
requirement source; generalize that notion.

Fixes SR-5601.
2017-08-10 17:00:07 -07:00

25 lines
607 B
Swift

// RUN: %target-swift-frontend %s -typecheck -verify
// RUN: %target-swift-frontend %s -emit-ir -o /dev/null
// SR-5601
protocol P1 {
associatedtype X: P3 where X.Q == Self, X.R == UInt8
associatedtype Y: P3 where Y.Q == Self, Y.R == UInt16
// NOTE: Removing either X or Y from P1 (and A) makes the program compile.
}
struct A: P1 {
typealias X = S<UInt8>
typealias Y = S<UInt16>
}
protocol P2 { }
protocol P3 : P2 { // NOTE: Removing ": P2 " here makes the program compile.
associatedtype Q: P1
associatedtype R
}
struct S<E> : P3 {
typealias R = E
typealias Q = A
}