Commit Graph

20 Commits

Author SHA1 Message Date
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
780b58a9a5 [Parser] update tests for 'inout' syntax adjustment 2016-02-26 01:33:22 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
ken0nek
3ac60b13f5 Add spaces before and after closure arrow in test 2015-12-23 04:38:46 +09:00
Dmitri Gribenko
feacbc4433 Rename ErrorType to ErrorProtocol 2015-12-09 17:12:19 -08:00
Jordan Rose
77d8a079af Special-case trying to force a 'try?' expression.
...both in the message and in the fix-it, which offers to change it to
'try!'.

More rdar://problem/22259867.

Swift SVN r31201
2015-08-13 03:08:18 +00:00
Jordan Rose
a690885f5c Properly parenthesize 'try?' in fix-its.
It's not /really/ an infix operator, but it behaves like a very low
precedence prefix operator. On the other hand, 'try' and 'try!' can
freely move in and out of all the operations we add in fix-its, so
don't bother.

rdar://problem/22259867

Swift SVN r31200
2015-08-13 03:08:17 +00:00
Jordan Rose
a26716290c When adding " != nil" to an optional in an 'if', we may need parens.
...such as with 'try?'.

rdar://problem/22259712

Swift SVN r31199
2015-08-13 03:08:15 +00:00
Jordan Rose
410083dfc9 Warn on unused results in single-expression closures coerced to Void.
...just like an unused result anywhere else.

Swift SVN r31091
2015-08-08 00:23:05 +00:00
Jordan Rose
bd031d1515 Always warn when 'try?' is discarded.
rdar://problem/22195906

Swift SVN r31090
2015-08-08 00:23:00 +00:00
Jordan Rose
185326755c 'try?' is supposed to stack optionals, not merge them.
More rdar://problem/21692467

Swift SVN r31059
2015-08-06 21:02:40 +00:00
Jordan Rose
2801d47e59 Add Parse and Sema support for 'try?'.
rdar://problem/21692467

Swift SVN r31030
2015-08-05 22:17:25 +00:00
Chris Lattner
ada5487153 add fixit tests to random other tests.
Swift SVN r31006
2015-08-04 20:35:36 +00:00
Chris Lattner
9d9b8aaf35 move protocol conformance errors away from being diagnosed as a Failure, instead
putting it into the expr diagnostics path, allowing more contextual messages.


Swift SVN r30920
2015-08-01 18:31:59 +00:00
Chris Lattner
40d2b99aa4 fix:
<rdar://problem/21414023> Assertion failure when compiling function that takes throwing functions and rethrows
<rdar://problem/21432429> Calling rethrows from rethrows crashes Swift compiler
<rdar://problem/21427855> Swift 2: Omitting try from call to throwing closure in rethrowing function crashes compiler



Swift SVN r29580
2015-06-23 21:48:58 +00:00
Chris Lattner
9df3cccb06 make the error message and diagnostic location for
throwing operators not marked "try" more specific.


Swift SVN r29368
2015-06-12 18:33:56 +00:00
Jordan Rose
0c77785020 [Parser] Explicitly reject "try" before a statement with a specific diagnostic.
And for "try return", "try throw", and "try let", get even more specific,
with a fix-it to suggest moving the "try" onto the expression.

rdar://problem/21043120

Swift SVN r28862
2015-05-21 00:12:36 +00:00
John McCall
5c171fd448 Parsing, type-checking, SILGen, and IRGen for try!.
Swift SVN r28085
2015-05-02 08:03:15 +00:00
John McCall
fdcecfcfb7 Move error-handling diagnostics to Sema and check try coverage.
Needs better test-case coverage.

Swift SVN r27898
2015-04-29 00:49:40 +00:00
John McCall
dd48c25d3f Parse 'try' expressions.
We parse 'try' as if it were a unary operator allowed on an
arbitrary element of an expr-sequence, but sequence-folding
constrains it to never appear on the RHS of most operators.

We do allow it on the RHS of an assignment or conditional
operator, but not if there's anything to the right which
was not parsed within the RHS.

We do this for assignments so that
  var x = try whatever
and
  x = try whatever
both work as you might expect.

We do this for conditionals because it feels natural to
allow 'try' in the center operand, and then disallowing it
in the right operand feels very strange.

In both case, this works largely because these operators are
assumed to be very low-precedence; there are no standard
operators which would parse outside the RHS.  But if you
create one and use 'try' before it, we'll diagnose it.

Swift SVN r26052
2015-03-12 18:59:21 +00:00