Skip to content

Commit fe75380

Browse files
authored
Merge pull request #15407 from tkremenek/driver-ver-4.2
[WIP] Added -swift-version support for 4.2
2 parents 20a48e5 + c912fcd commit fe75380

File tree

12 files changed

+214
-18
lines changed

12 files changed

+214
-18
lines changed

include/swift/Basic/Version.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class Version {
119119
/// Return this Version struct with minor and sub-minor components stripped
120120
Version asMajorVersion() const;
121121

122+
/// Return this Version struct as the appropriate version string for APINotes.
123+
std::string asAPINotesVersionString() const;
124+
122125
/// Parse a version in the form used by the _compiler_version \#if condition.
123126
static Optional<Version> parseCompilerVersionString(StringRef VersionString,
124127
SourceLoc Loc,
@@ -143,8 +146,8 @@ class Version {
143146

144147
// List of backward-compatibility versions that we permit passing as
145148
// -swift-version <vers>
146-
static std::array<StringRef, 3> getValidEffectiveVersions() {
147-
return {{"3", "4", "5"}};
149+
static std::array<StringRef, 4> getValidEffectiveVersions() {
150+
return {{"3", "4", "4.2", "5"}};
148151
};
149152
};
150153

lib/Basic/Version.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/Basic/CharInfo.h"
1818
#include "llvm/Support/raw_ostream.h"
1919
#include "llvm/ADT/SmallString.h"
20+
#include "llvm/ADT/StringExtras.h"
2021
#include "swift/AST/DiagnosticsParse.h"
2122
#include "swift/Basic/LLVM.h"
2223
#include "swift/Basic/Version.h"
@@ -303,6 +304,12 @@ Optional<Version> Version::getEffectiveLanguageVersion() const {
303304
return None;
304305
case 1:
305306
break;
307+
case 2:
308+
// The only valid explicit language version with a minor
309+
// component is 4.2.
310+
if (Components[0] == 4 && Components[1] == 2)
311+
break;
312+
return None;
306313
default:
307314
// We do not want to permit users requesting more precise effective language
308315
// versions since accepting such an argument promises more than we're able
@@ -326,6 +333,9 @@ Optional<Version> Version::getEffectiveLanguageVersion() const {
326333
case 4:
327334
static_assert(SWIFT_VERSION_MAJOR == 4,
328335
"getCurrentLanguageVersion is no longer correct here");
336+
// Version '4' on its own implies '4.1.50'.
337+
if (size() == 1)
338+
return Version{4, 1, 50};
329339
return Version::getCurrentLanguageVersion();
330340
case 5:
331341
return Version{5, 0};
@@ -342,6 +352,16 @@ Version Version::asMajorVersion() const {
342352
return res;
343353
}
344354

355+
std::string Version::asAPINotesVersionString() const {
356+
// Other than for "4.2.x", map the Swift major version into
357+
// the API notes version for Swift. This has the effect of allowing
358+
// API notes to effect changes only on Swift major versions,
359+
// not minor versions.
360+
if (size() >= 2 && Components[0] == 4 && Components[1] == 2)
361+
return "4.2";
362+
return llvm::itostr(Components[0]);
363+
}
364+
345365
bool operator>=(const class Version &lhs,
346366
const class Version &rhs) {
347367

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,8 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
611611
}
612612
invocationArgStrs.push_back("-iapinotes-modules");
613613
invocationArgStrs.push_back(searchPathOpts.RuntimeLibraryImportPath);
614-
615-
// Map the Swift major version into the API notes version for Swift. This
616-
// has the effect of allowing API notes to effect changes only on Swift
617-
// major versions, not minor versions.
618614
invocationArgStrs.push_back("-fapinotes-swift-version=" +
619-
llvm::itostr(languageVersion[0]));
615+
languageVersion.asAPINotesVersionString());
620616
}
621617

622618
static void

lib/ClangImporter/ImportName.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ checkVersionedSwiftName(VersionedSwiftNameInfo info,
578578
if (!bestSoFar.empty() && bestSoFar <= info.Version)
579579
return VersionedSwiftNameAction::Ignore;
580580

581+
auto requestedClangVersion = requestedVersion.asClangVersionTuple();
582+
581583
if (info.IsReplacedByActive) {
582584
// We know that there are no versioned names between the active version and
583585
// a replacement version, because otherwise /that/ name would be active.
@@ -586,15 +588,15 @@ checkVersionedSwiftName(VersionedSwiftNameInfo info,
586588
// new value that is now active. (Special case: replacement = 0 means that
587589
// a header annotation was replaced by an unversioned API notes annotation.)
588590
if (info.Version.empty() ||
589-
info.Version.getMajor() >= requestedVersion.majorVersionNumber()) {
591+
info.Version >= requestedClangVersion) {
590592
return VersionedSwiftNameAction::ResetToActive;
591593
}
592594
if (bestSoFar.empty())
593595
return VersionedSwiftNameAction::UseAsFallback;
594596
return VersionedSwiftNameAction::Ignore;
595597
}
596598

597-
if (info.Version.getMajor() < requestedVersion.majorVersionNumber())
599+
if (info.Version < requestedClangVersion)
598600
return VersionedSwiftNameAction::Ignore;
599601
return VersionedSwiftNameAction::Use;
600602
}

lib/ClangImporter/ImportName.h

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,35 @@ class ImportNameVersion : public RelationalOperationsBase<ImportNameVersion> {
5656
public:
5757
/// Map a language version into an import name version.
5858
static ImportNameVersion fromOptions(const LangOptions &langOpts) {
59-
return ImportNameVersion(langOpts.EffectiveLanguageVersion[0]);
59+
// We encode the 'rawValue' as just major version numbers with the
60+
// exception of '4.2', which is a special minor version that can impact
61+
// importing of names. We treat that with a rawValue of 5, and treat
62+
// all major values of 5 or higher as being rawValue = majorversion + 1.
63+
const auto &version = langOpts.EffectiveLanguageVersion;
64+
if (version.size() > 1 && version[0] == 4 && version[1] == 2) {
65+
return ImportNameVersion::swift4_2();
66+
}
67+
unsigned major = version[0];
68+
return ImportNameVersion(major >= 5 ? major + 1 : major);
6069
}
6170

6271
unsigned majorVersionNumber() const {
6372
assert(*this != ImportNameVersion::raw());
64-
return rawValue;
73+
if (*this == ImportNameVersion::swift4_2())
74+
return 4;
75+
return rawValue < 5 ? rawValue : rawValue - 1;
76+
}
77+
78+
unsigned minorVersionNumber() const {
79+
assert(*this != ImportNameVersion::raw());
80+
if (*this == ImportNameVersion::swift4_2())
81+
return 2;
82+
return 0;
83+
}
84+
85+
clang::VersionTuple asClangVersionTuple() const {
86+
assert(*this != ImportNameVersion::raw());
87+
return clang::VersionTuple(majorVersionNumber(), minorVersionNumber());
6588
}
6689

6790
bool operator==(ImportNameVersion other) const {
@@ -105,12 +128,17 @@ class ImportNameVersion : public RelationalOperationsBase<ImportNameVersion> {
105128
return ImportNameVersion{2, AsConstExpr};
106129
}
107130

131+
/// Names as they appeared in Swift 4.2 family.
132+
static constexpr inline ImportNameVersion swift4_2() {
133+
return ImportNameVersion{5, AsConstExpr};
134+
}
135+
108136
/// The latest supported version.
109137
///
110138
/// FIXME: All other version information is in Version.h. Can this go there
111139
/// instead?
112140
static constexpr inline ImportNameVersion maxVersion() {
113-
return ImportNameVersion{5, AsConstExpr};
141+
return ImportNameVersion{6, AsConstExpr};
114142
}
115143

116144
/// The version which should be used for importing types, which need to have

test/APINotes/Inputs/custom-frameworks/APINotesFrameworkTest.framework/Headers/APINotesFrameworkTest.apinotes

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ SwiftVersions:
259259
SwiftName: multiVersionedGlobal45Notes_5
260260
- Name: multiVersionedGlobal45Both
261261
SwiftName: multiVersionedGlobal45Both_5
262-
- Version: 4 # Versions are deliberately ordered as "3, 5, 4" to catch bugs.
262+
- Version: 4 # Versions are deliberately ordered as "3, 5, 4.2, 4" to catch bugs.
263263
Globals:
264264
- Name: multiVersionedGlobal34
265265
SwiftName: multiVersionedGlobal34_4
@@ -293,3 +293,39 @@ SwiftVersions:
293293
SwiftName: multiVersionedGlobal45Notes_4
294294
- Name: multiVersionedGlobal45Both
295295
SwiftName: multiVersionedGlobal45Both_4
296+
- Version: 4.2
297+
Globals:
298+
- Name: multiVersionedGlobal34
299+
SwiftName: multiVersionedGlobal34_4_2
300+
- Name: multiVersionedGlobal34Header
301+
SwiftName: multiVersionedGlobal34Header_4_2
302+
- Name: multiVersionedGlobal34Notes
303+
SwiftName: multiVersionedGlobal34Notes_4_2
304+
- Name: multiVersionedGlobal34Both
305+
SwiftName: multiVersionedGlobal34Both_4_2
306+
- Name: multiVersionedGlobal345
307+
SwiftName: multiVersionedGlobal345_4_2
308+
- Name: multiVersionedGlobal345Header
309+
SwiftName: multiVersionedGlobal345Header_4_2
310+
- Name: multiVersionedGlobal345Notes
311+
SwiftName: multiVersionedGlobal345Notes_4_2
312+
- Name: multiVersionedGlobal345Both
313+
SwiftName: multiVersionedGlobal345Both_4_2
314+
- Name: multiVersionedGlobal4
315+
SwiftName: multiVersionedGlobal4_4_2
316+
- Name: multiVersionedGlobal4Header
317+
SwiftName: multiVersionedGlobal4Header_4_2
318+
- Name: multiVersionedGlobal4Notes
319+
SwiftName: multiVersionedGlobal4Notes_4_2
320+
- Name: multiVersionedGlobal4Both
321+
SwiftName: multiVersionedGlobal4Both_4_2
322+
- Name: multiVersionedGlobal45
323+
SwiftName: multiVersionedGlobal45_4_2
324+
- Name: multiVersionedGlobal45Header
325+
SwiftName: multiVersionedGlobal45Header_4_2
326+
- Name: multiVersionedGlobal45Notes
327+
SwiftName: multiVersionedGlobal45Notes_4_2
328+
- Name: multiVersionedGlobal45Both
329+
SwiftName: multiVersionedGlobal45Both_4_2
330+
- Name: multiVersionedGlobal34_4_2
331+
SwiftName: multiVersionedGlobal34_4_2_not_5

test/APINotes/Inputs/custom-frameworks/APINotesFrameworkTest.framework/Headers/Globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ int multiVersionedGlobal345Notes;
2020
int multiVersionedGlobal345Header __attribute__((swift_name("multiVersionedGlobal345Header_NEW")));
2121
int multiVersionedGlobal345Both __attribute__((swift_name("multiVersionedGlobal345Both_OLD")));
2222

23+
int multiVersionedGlobal34_4_2;
24+
2325
#pragma clang assume_nonnull end

test/APINotes/versioned-multi.swift

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// RUN: %target-swift-ide-test -F %S/Inputs/custom-frameworks -print-module -source-filename %s -module-to-print=APINotesFrameworkTest -function-definitions=false -swift-version 4 | %FileCheck -check-prefix=CHECK-SWIFT-4 %s
66

7+
// RUN: %target-swift-ide-test -F %S/Inputs/custom-frameworks -print-module -source-filename %s -module-to-print=APINotesFrameworkTest -function-definitions=false -swift-version 4.2 | %FileCheck -check-prefix=CHECK-SWIFT-4-2 %s
8+
79
// RUN: %target-swift-ide-test -F %S/Inputs/custom-frameworks -print-module -source-filename %s -module-to-print=APINotesFrameworkTest -function-definitions=false -swift-version 5 | %FileCheck -check-prefix=CHECK-SWIFT-5 %s
810

911
// CHECK-SWIFT-3: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4_4")
@@ -101,6 +103,9 @@
101103
// CHECK-SWIFT-3: var multiVersionedGlobal345Both_4: Int32
102104
// CHECK-SWIFT-3: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345Both_3")
103105
// CHECK-SWIFT-3: var multiVersionedGlobal345Both_5: Int32
106+
// CHECK-SWIFT-3: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34_4_2_not_5")
107+
// CHECK-SWIFT-3: var multiVersionedGlobal34_4_2: Int32
108+
// CHECK-SWIFT-3: var multiVersionedGlobal34_4_2_not_5: Int32
104109

105110

106111
// CHECK-SWIFT-4: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4_4")
@@ -198,6 +203,108 @@
198203
// CHECK-SWIFT-4: var multiVersionedGlobal345Both_4: Int32
199204
// CHECK-SWIFT-4: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345Both_4")
200205
// CHECK-SWIFT-4: var multiVersionedGlobal345Both_5: Int32
206+
// CHECK-SWIFT-4: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34_4_2_not_5")
207+
// CHECK-SWIFT-4: var multiVersionedGlobal34_4_2: Int32
208+
// CHECK-SWIFT-4: var multiVersionedGlobal34_4_2_not_5: Int32
209+
210+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4_4_2")
211+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4: Int32
212+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4_4: Int32
213+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4Notes_4_2")
214+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Notes: Int32
215+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Notes_4: Int32
216+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal4Notes_4_2")
217+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Notes_NEW: Int32
218+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4Header_4_2")
219+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Header: Int32
220+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Header_4: Int32
221+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal4Header_4_2")
222+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Header_NEW: Int32
223+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal4Both_4_2")
224+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Both: Int32
225+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Both_4: Int32
226+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal4Both_4_2")
227+
// CHECK-SWIFT-4-2: var multiVersionedGlobal4Both_NEW: Int32
228+
229+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34_4_2")
230+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34: Int32
231+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal34_4_2")
232+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34_3: Int32
233+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34_4: Int32
234+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34Notes_4_2")
235+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Notes: Int32
236+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal34Notes_4_2")
237+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Notes_3: Int32
238+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Notes_4: Int32
239+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal34Notes_4_2")
240+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Notes_NEW: Int32
241+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34Header_4_2")
242+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Header: Int32
243+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal34Header_4_2")
244+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Header_3: Int32
245+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Header_4: Int32
246+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal34Header_4_2")
247+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Header_NEW: Int32
248+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34Both_4_2")
249+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Both: Int32
250+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal34Both_4_2")
251+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Both_3: Int32
252+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Both_4: Int32
253+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal34Both_4_2")
254+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34Both_NEW: Int32
255+
256+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal45_4_2")
257+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45: Int32
258+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45_4: Int32
259+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal45_4_2")
260+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45_5: Int32
261+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal45Notes_4_2")
262+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Notes: Int32
263+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Notes_4: Int32
264+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal45Notes_4_2")
265+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Notes_5: Int32
266+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal45Header_4_2")
267+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Header: Int32
268+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Header_4: Int32
269+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal45Header_4_2")
270+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Header_5: Int32
271+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal45Both_4_2")
272+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Both: Int32
273+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Both_4: Int32
274+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal45Both_4_2")
275+
// CHECK-SWIFT-4-2: var multiVersionedGlobal45Both_5: Int32
276+
277+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal345_4_2")
278+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345: Int32
279+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal345_4_2")
280+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345_3: Int32
281+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345_4: Int32
282+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345_4_2")
283+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345_5: Int32
284+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal345Notes_4_2")
285+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Notes: Int32
286+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal345Notes_4_2")
287+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Notes_3: Int32
288+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Notes_4: Int32
289+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345Notes_4_2")
290+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Notes_5: Int32
291+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal345Header_4_2")
292+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Header: Int32
293+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal345Header_4_2")
294+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Header_3: Int32
295+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Header_4: Int32
296+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345Header_4_2")
297+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Header_5: Int32
298+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal345Both_4_2")
299+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Both: Int32
300+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 4, renamed: "multiVersionedGlobal345Both_4_2")
301+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Both_3: Int32
302+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Both_4: Int32
303+
// CHECK-SWIFT-4-2: @available(swift, introduced: 5, renamed: "multiVersionedGlobal345Both_4_2")
304+
// CHECK-SWIFT-4-2: var multiVersionedGlobal345Both_5: Int32
305+
// CHECK-SWIFT-4-2: @available(swift, obsoleted: 3, renamed: "multiVersionedGlobal34_4_2_not_5")
306+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34_4_2: Int32
307+
// CHECK-SWIFT-4-2: var multiVersionedGlobal34_4_2_not_5: Int32
201308

202309

203310
// CHECK-SWIFT-5: var multiVersionedGlobal4: Int32
@@ -295,3 +402,5 @@
295402
// CHECK-SWIFT-5: @available(swift, obsoleted: 5, renamed: "multiVersionedGlobal345Both_5")
296403
// CHECK-SWIFT-5: var multiVersionedGlobal345Both_4: Int32
297404
// CHECK-SWIFT-5: var multiVersionedGlobal345Both_5: Int32
405+
// CHECK-SWIFT-5: @available(swift, obsoleted: 5, renamed: "multiVersionedGlobal34_4_2")
406+
// CHECK-SWIFT-5: var multiVersionedGlobal34_4_2_not_5: Int32

test/Driver/swift-version.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: not %target-swiftc_driver -swift-version 5 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_5 %s
1515

1616
// BAD: invalid value
17-
// BAD: note: valid arguments to '-swift-version' are '3', '4', '5'
17+
// BAD: note: valid arguments to '-swift-version' are '3', '4', '4.2', '5'
1818

1919
// FIXIT_3: use major version, as in '-swift-version 3'
2020
// FIXIT_4: use major version, as in '-swift-version 4'

test/Parse/ConditionalCompilation/language_version_explicit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -swift-version 4
1+
// RUN: %target-typecheck-verify-swift -swift-version 4.2
22

33
#if swift(>=4)
44
let w = 1

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend -emit-module -o %t -module-name Lib -I %S/Inputs/custom-modules -swift-version 3 %s
33

44
// RUN: echo 'import Lib; _ = Sub.disappearingMethod' | not --crash %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -swift-version 3 -disable-deserialization-recovery -Xcc -DBAD - 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-3 %s
5-
// RUN: echo 'import Lib; _ = Sub.disappearingMethod' | not --crash %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -swift-version 4 -disable-deserialization-recovery -Xcc -DBAD - 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-4 %s
5+
// RUN: echo 'import Lib; _ = Sub.disappearingMethod' | not --crash %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -swift-version 4.2 -disable-deserialization-recovery -Xcc -DBAD - 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-4 %s
66

77
// REQUIRES: objc_interop
88

0 commit comments

Comments
 (0)