Commits
Chris Lattner committed d69a1a00d71
Fix <rdar://problem/21080671> QoI: try/catch (instead of do/catch) creates silly diagnostics
People will keep typing try/catch either due to muscle memory from other languages or
when they are first learning swift. We now produce a nice error message + fixit of:
t.swift:14:3: error: the 'do' keyword is used to specify a 'catch' region
try {
^~~
do
instead of spewing out:
t.swift:15:4: error: consecutive statements on a line must be separated by ';'
} catch { }
^
;
t.swift:15:5: error: expected expression
} catch { }
^
t.swift:15:11: error: braced block of statements is an unused closure
} catch { }
^
t.swift:14:7: error: expression resolves to an unused function
try {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t.swift:15:11: error: expression resolves to an unused function
} catch { }
^~~
t.swift:14:3: warning: no calls to throwing functions occur within 'try' expression
try {
^