Don't diagnose failures to call symmetrically-typed binary operators

as a failure to convert the individual operand, since the operator
is likely conceptually generic in some way and the choice of any
specific overload is probably arbitrary.

Since we now fall back to a better-informed diagnostics point, take
advantage of this to generate a specialized diagnostic when trying to
compare values of function type with ===.

Fixes rdar://25666129.

This reverts commit 073f427942,
i.e. it reapplies 35ba809fd0 with a
test fix to expect an extra note in one place.
This commit is contained in:
John McCall
2016-05-11 16:07:25 -07:00
parent 073f427942
commit e75dae491e
13 changed files with 85 additions and 30 deletions

View File

@@ -140,7 +140,7 @@ default: break
// <rdar://problem/21995744> QoI: Binary operator '~=' cannot be applied to operands of type 'String' and 'String?'
switch ("foo" as String?) {
case "what": break // expected-error{{value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?}}
case "what": break // expected-error{{expression pattern of type 'String' cannot match values of type 'String?'}}
default: break
}