Doug Gregor
dd96aee1b1
[Type checker] Fix rethrow checking with a single argument label harder.
...
My original fix for rdar://problem/31794932 didn't work for generic
functions because it was checking in the unsubstituted interface
type. Check structurally instead. Fixes rdar://problem/31794932.
2017-04-25 12:37:32 -07:00
Doug Gregor
b07d9951e4
[Type checker] Handle 'rethrows' checks for single-parameter functions.
...
The throw-checking code wasn't properly coping with functions that
take a single, labeled argument, due to the longstanding lie that
pretends that functions take a tuple argument vs. zero or more
separate arguments. Here, the lie manifests as spurious "call can
throw, but is not marked as such" errors.
Fixes rdar://problem/31794932.
2017-04-24 14:48:54 -07:00
Joe Groff
e9544bae0a
Sema: Look through DotSyntaxBaseIgnored when finding function DeclRefs for rethrows checking.
...
Fixes rdar://problem/30618853.
2017-02-24 16:04:47 -08:00
Rintaro Ishizaki
e4c18ba9ba
[Parse] Add fix-it for 'rethrows' in function type
2016-11-30 23:09:38 +09:00
David Farler
b7d17b25ba
Rename -parse flag to -typecheck
...
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Michael Ilseman
f48471ebd4
[noescape by default] purge tests of needless @noescape
2016-08-04 16:14:27 -07:00
Robert Widmann
4f465224ea
Polish off uses of dynamicType in tests
2016-07-29 16:59:14 -07:00
Doug Gregor
823c24b355
[SE-0112] Rename ErrorProtocol to Error.
...
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Trent Nadeau
0cc851568a
Updated tests to use @discardableResult and _ = .
2016-05-11 22:53:38 -04:00
Chris Lattner
8746676616
Move @noescape and @autoclosure to their new places in various tests, NFC.
2016-04-15 16:05:35 -07:00
Manav Gabhawala
7928140f79
[SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary
2016-04-06 20:21:58 -04:00
Alex Hoppen
3f115d4e12
[Sema] SR-317: Allow rethrowing functions to take an optional function parameter
2016-03-11 13:22:54 +01:00
Max Moiseev
cf4bafe9e3
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-03-03 13:22:03 -08:00
Kevin Ballard
88a45b6bd0
[Sema][SR-681] Allow catch blocks to rethrow errors when safe
...
A catch block can only be entered if the do block threw an error. In a
rethrows function, if the do block throws an error only under rethrows
conditions, then the catch block can only be entered under rethrows
conditions, which means the catch block can unconditionally throw and
it's still safe.
This enables code that looks like
```swift
func foo(f: () throws -> Void) rethrows {
do {
try f()
} catch is SomeError {
throw OtherError()
}
}
```
2016-02-26 23:19:13 -08:00
Max Moiseev
61c837209b
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-02-04 16:13:39 -08:00
Chris Willmore
983a674e0c
Make use of curried function declaration syntax an error.
...
<rdar://problem/23111018>
2016-01-20 21:57:38 -08:00
Doug Gregor
7d70b704e4
Merge commit '5e11e3f7287427d386636a169c4065c0373931a8' into swift-3-api-guidelines
2016-01-19 23:18:20 -08:00
Chris Lattner
a8deb14ce0
add comment with radar title
2016-01-16 23:18:06 -08:00
Chris Lattner
20263bf466
fix <rdar://problem/24221830> Bogus "no calls to throwing functions" warning in derived throwing init
...
This is a case where we used to produce:
<unknown>:0: warning: no calls to throwing functions occur within 'try' expression
Which is bogus, due to the try expr implicitly generated as part of the
implicit super.init call for an init that doesn't otherwise contain a super.init.
Silence this warning by ignoring implicitly generated trys, since this try gets
produced before name binding has resolved exactly which try is being invoked.
2016-01-16 23:15:47 -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
Chris Willmore
30af42fda9
Add warning that curried function decl syntax is going away.
...
<rdar://problem/23111018>
2015-11-02 15:45:11 -08:00
Jordan Rose
4c82fe3394
Tweak diagnostic text for 'rethrows'-related mistakes.
...
The first two are now more in line with the messages you get for
non-'rethrows' functions.
rdar://problem/21654534
Swift SVN r30558
2015-07-24 02:45:11 +00:00
Joe Pamer
2d86296827
When converting a closure's function type to a non-escaping function type, only propagate the 'throws' ExtInfo bit if necessary. (rdar://problem/21881995)
...
Swift SVN r30556
2015-07-23 23:35:42 +00:00
John McCall
7a5ffeddf4
Implement 'rethrows' checking in Sema.
...
Now with amazing new fixes and tests for methods and generics!
Swift SVN r28499
2015-05-13 00:03:09 +00:00
Ted Kremenek
07251be929
Revert "Implement 'rethrows' checking in Sema."
...
This was asserting in the performance suite.
Swift SVN r28491
2015-05-12 22:37:20 +00:00
John McCall
3e4bcab7fb
Implement 'rethrows' checking in Sema.
...
Swift SVN r28488
2015-05-12 22:10:41 +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
3d3f1a7d7e
Parsing/AST/Sema support for rethrows, and fix bugs with
...
throws/rethrows override and conformance checking.
Swift SVN r27508
2015-04-20 23:39:12 +00:00