Commit Graph

5 Commits

Author SHA1 Message Date
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
Devin Coughlin
1165aca545 [Sema] Suppress deprecation/availability diagnostics in branches with empty availability
We currently emit diagnostics for references to deprecated and potentially
unavailable APIs in branches that are dead for the current platform and
minimum deployment target. These dead branches can arise when sharing swift
source between targets or in playgrounds intended to be run on multiple OS
versions.

So for example, suppose the developer has the following code targeting
OSX 10.9+ and iOS 8.0+:

if #available(OSX 10.10, *) {
  // Use replacement API introduced in OSX 10.10/iOS 8.0
} else {
  // Use old API deprecated in OSX 10.10/iOS 8.0
}

Compiling the above for iOS and with a miniminum deployment of 8.0 will
result in a deprecation diagnostic for the use of the API in the else branch
even though that branch will never execute. (Note that the branch is not dead on
the OSX target because the minimum deployment target is 10.9. For OSX we also
won't emit a deprecation warning because the API wasn't deprecated until 10.10.

This commit updates availability checking to create refinement contexts with
empty OS version ranges for #available() else branches when those branches
will definitely not execute. It suppresses deprecation and potential
availability diagnostics within those contexts. It does not suppress diagnostics
for references to APIs annotated as unconditionally unavailable (i.e., with
@available(OSX, unavailable, ...) and friends).

rdar://problem/22307360

Swift SVN r31631
2015-09-02 18:18:30 +00:00
Devin Coughlin
ea18bc0c0b Rename -dump-trc option to -dump-type-refinement-contexts
As Jordan notes, 'TRC' is not a commonly-known acronym for most Swift compiler developers.

Swift SVN r30414
2015-07-20 21:47:49 +00:00
Devin Coughlin
1fbe423622 Sema: Update TypeRefinementContext to be able to handle more kinds of introduction nodes. NFC
Move away from PointerUnion4 to represent the node that introduced a refinement context.
This is needed to support availability for CatchStmts, where refinement contexts will be
introduced by patterns. This is NFC, but it includes part of a test I mistakenly left
out in r30383.

Swift SVN r30385
2015-07-19 17:51:08 +00:00
Devin Coughlin
b427975c39 Add a -dump-trc frontend option to print the type refinement context hierarchy
This is useful for debugging and testing.

Swift SVN r30383
2015-07-19 05:53:27 +00:00