Commits
Chris Lattner committed be906493acb
Teach CSDiag how to recursively walk into an arbitrary expression, to produce
its diagnostics in post-order. Notably, this picks up support for if-expr, which
gives up much better diagnostics in ternary operators. For example, rdar://17224804
used to produce:
error: could not find an overload for '<=' that accepts the supplied arguments
var monthString = (monthNumber <= 9) ? ("0" + monthNumber) : String(monthNumber)
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
now we produce:
error: binary operator '+' cannot be applied to operands of type 'String' and 'Int'
var monthString = (monthNumber <= 9) ? ("0" + monthNumber) : String(monthNumber)
~~~ ^ ~~~~~~~~~~~
note: overloads for '+' exist with these partially matching parameter lists: (Int, Int), (String, String), (UnsafeMutablePointer<Memory>, Int), (UnsafePointer<Memory>, Int)
var monthString = (monthNumber <= 9) ? ("0" + monthNumber) : String(monthNumber)
^
which is the correct diagnostic. While I'm at it, improve the location info for this
binary operator diagnostic to point to the right spot (the operator) and highlight
the LHS/RHS of the operator.
Swift SVN r29774