[CS] A couple of minor improvements to operator diagnostics

- Simplify the fix locator when looking for a
fix already present in a pattern match, this
avoids us emitting both a diagnostic for the
argument conversion, and for a conformance failure.
- Include tuples in the diagnostic logic where
we emit a generic "operator cannot be applied"
diagnostic, as a conformance diagnostic is
unlikely to be helpful in that case.
This commit is contained in:
Hamish Knight
2023-05-04 14:36:16 +01:00
parent b5e9bbb68d
commit 68075696eb
4 changed files with 14 additions and 14 deletions

View File

@@ -144,9 +144,6 @@ func test17875634() {
func test20770032() {
if case let 1...10 = (1, 1) { // expected-warning{{'let' pattern has no effect; sub-pattern didn't bind any variables}} {{11-15=}}
// expected-error@-1 {{expression pattern of type 'ClosedRange<Int>' cannot match values of type '(Int, Int)'}}
// expected-error@-2 {{type '(Int, Int)' cannot conform to 'Equatable'}}
// expected-note@-3 {{only concrete types such as structs, enums and classes can conform to protocols}}
// expected-note@-4 {{required by operator function '~=' where 'T' = '(Int, Int)'}}
}
}