mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
`InferredGenericSignatureRequest` creates `StructuralRequirement`s for the requirements of the generic signature that is passed to it (if one is). Previously, it used invalid `SourceLoc`s for these requirements. The result was that when errors that were emitted as a result of those `StructuralRequirement`s (during concrete type contraction), they would also have invalid `SourceLoc`s. The effect was that those errors were ignored during `diagnoseRequirementErrors`. Here, use the available loc for those requirements. rdar://108963047
16 lines
406 B
Swift
16 lines
406 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
protocol HasElt {
|
|
associatedtype Element
|
|
}
|
|
struct IntElement : HasElt {
|
|
typealias Element = Int
|
|
}
|
|
struct FloatElement : HasElt {
|
|
typealias Element = Float
|
|
}
|
|
|
|
struct G<T: HasElt> where T.Element == Float {
|
|
func foo() where T == IntElement {} // expected-error {{generic signature requires types 'IntElement.Element' (aka 'Int') and 'Float' to be the same}}
|
|
}
|