Commit Graph

12 Commits

Author SHA1 Message Date
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Slava Pestov
79b24fa7d1 Update availability tests to be independent of the actual deployment target
Use fictional version numbers in the 10.50..10.99 range.
2016-01-13 19:27:26 -08:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
Devin Coughlin
c67ac0d63b [Sema] Add source location for synthesized designated initializer overrides.
When synthesizing designated initializer overrides, set the source location
for the synthesized ConstructorDecl to the location of the opening brace of
the containing ClassDecl. This resolves an assertion failure when constructing
type refinement contexts when whole-program optimization is turned on.

rdar://problem/21233342

Swift SVN r29384
2015-06-15 19:46:09 +00:00
Chris Lattner
e4b6afb9ae Start moving the testsuite to the "_ = foo()" idiom for evaluating an
expression but ignoring its value.  This is the right canonical way to do
this.  NFC, just testsuite changes.



Swift SVN r28638
2015-05-15 20:15:54 +00:00
Ted Kremenek
62feb5c949 Change @availability to @available.
This came out of today's language review meeting.
The intent is to match #available with the attribute
that describes availability.

This is a divergence from Objective-C.

Swift SVN r28484
2015-05-12 20:06:13 +00:00
Devin Coughlin
d08b98b1ca Sema: Turn on availability checking by default
Enable checking for uses of potentially unavailable APIs. There is
a frontend option to disable it: -disable-availability-checking.

This commit updates the SDK overlays with @availability() annotations for the
declarations where the overlay refers to potentially unavailable APIs. It also changes
several tests that refer to potentially unavailable APIs to use either #available()
or @availability annotations.

Swift SVN r27272
2015-04-14 06:44:01 +00:00
Devin Coughlin
53fd9fb59c Sema: Finish staging back in availability checking in synthesized functions
Remove the suppression of deprecation and potential unavailability diagnostics in
synthesized functions. We still suppress some explicit unavailability diagnostics -- those
in synthesized functions in synthesized functions that are lexically contained in
declarations that are themselves annotated as unavailable. For these cases, the right
solution <rdar://problem/20491640> is to not synthesize the bodies of these functions in
the first place.

rdar://problem/20024980

Swift SVN r27203
2015-04-10 05:19:04 +00:00
Devin Coughlin
cd79e0ba4d Sema: Suppress explicit unavailability diagnostics in unavailable synthesized functions.
Suppress diagnostics about references to unavailable declarations when all
of the following conditions are met:

(1) the reference is in synthesized code;
(2) the reference is in a synthesized method; and
(3) the reference is inside a declaration marked as unavailable.

This, combined with prior work to infer availability annotations for synthesized
methods should eliminate the spurious diagnostics we have seen (e.g.,
rdar://problem/20154926) for references to unavailable types without the hammer
of suppressing all references to unavailable declarations in synthesized
functions. The right thing to do here is to not synthesize the bodies of these
functions in the first place. I've filed <rdar://problem/20491640> to track
this.

We will continue to emit an error for references to unavailable declarations
in non-implicit code, even if the reference is inside a declaration marked
unavailable.

Swift SVN r27197
2015-04-10 02:07:24 +00:00
Devin Coughlin
bbdcf580ee Sema: Add @availability attributes when synthesizing materializeForSet accessors.
Synthesize implicit @availability attributes to make sure that a synthesized
materializeForSet accessor is available enough to access the underlying storage and its
getter and setter.

These synthesized attributes could trigger redundant diagnostics when a subclass gives
overriding getters or setters non-contravariant availability. We detect when this
happens and suppress the redundant diagnostics.

This commit also improves availability diagnostics in synthesized code. We now respect
synthesized @availability annotations on containing DeclContexts when determining the
potential OS versions that could be executed at invalid SourceLocations.

Swift SVN r27002
2015-04-05 03:02:20 +00:00
Devin Coughlin
8a8d53b10c Sema: Infer required availability for synthesized designated initializer overrides.
When synthesizing a designated initializer override, we now ensure that the synthesized
initializer has the same availability as the initializer it is overriding.

Swift SVN r26732
2015-03-30 22:06:06 +00:00
Devin Coughlin
bdc7475d6b Sema: Add temporary flag to stage in availability checking in implicit functions
This flag enables checking of availability (deprecation, explicit unavailability,
and potential unavailability) in synthesized functions. The flag will go away once this
checking is fully staged in.

Swift SVN r26624
2015-03-27 06:48:50 +00:00