mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSSimplify] Detect and diagnose conformance failures related to AnyHashable conversion
Failure of an argument to AnyHashable parameter to conform to Hashable protocol should be detected in `simplifyConformsToConstraint` and fixed there. Doing so requires impact assessment adjustment because regular conformance requirements have default impact of 1, this is going to have argument impact of 2 not avoid clashing with other failures.
This commit is contained in:
@@ -661,10 +661,7 @@ example21890157.property = "confusing" // expected-error {{value of optional ty
|
||||
|
||||
|
||||
struct UnaryOp {}
|
||||
|
||||
_ = -UnaryOp() // expected-error {{unary operator '-' cannot be applied to an operand of type 'UnaryOp'}}
|
||||
// expected-note@-1 {{overloads for '-' exist with these partially matching parameter lists: (Double), (Float)}}
|
||||
|
||||
|
||||
// <rdar://problem/23433271> Swift compiler segfault in failure diagnosis
|
||||
func f23433271(_ x : UnsafePointer<Int>) {}
|
||||
@@ -1551,3 +1548,12 @@ func rdar86611718(list: [Int]) {
|
||||
String(list.count())
|
||||
// expected-error@-1 {{cannot call value of non-function type 'Int'}}
|
||||
}
|
||||
|
||||
// rdar://108977234 - failed to produce diagnostic when argument to AnyHashable parameter doesn't conform to Hashable protocol
|
||||
do {
|
||||
struct NonHashable {}
|
||||
|
||||
func test(result: inout [AnyHashable], value: NonHashable) {
|
||||
result.append(value) // expected-error {{argument type 'NonHashable' does not conform to expected type 'Hashable'}}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user