Skip to content

Commit a7b27a5

Browse files
author
ematejska
authored
Merge pull request #11507 from ematejska/update_version_to_4_1
Updating compiler versions (4.1, 3.3, able to do swift-version 5)
2 parents 3d7ec38 + fcc515b commit a7b27a5

File tree

11 files changed

+30
-17
lines changed

11 files changed

+30
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ set_property(CACHE SWIFT_ANALYZE_CODE_COVERAGE PROPERTY
108108
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
109109
# can be reused when a new version of Swift comes out (assuming the user hasn't
110110
# manually set it as part of their own CMake configuration).
111-
set(SWIFT_VERSION "4.0")
111+
set(SWIFT_VERSION "4.1")
112112

113113
set(SWIFT_VENDOR "" CACHE STRING
114114
"The vendor name of the Swift compiler")

docs/Testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ FIXME: full list.
419419

420420
* ``optimized_stdlib_<CPUNAME>``: an optimized stdlib plus cpu configuration.
421421

422-
* ``SWIFT_VERSION=<MAJOR>``: restricts a test to Swift 3 or Swift 4. If you
422+
* ``SWIFT_VERSION=<MAJOR>``: restricts a test to Swift 3, Swift 4, Swift 5. If you
423423
need to use this, make sure to add a test for the other version as well
424424
unless you are specifically testing ``-swift-version``-related functionality.
425425

include/swift/Basic/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class Version {
137137

138138
// Whitelist of backward-compatibility versions that we permit passing as
139139
// -swift-version <vers>
140-
static std::array<StringRef, 2> getValidEffectiveVersions() {
141-
return {{"3", "4"}};
140+
static std::array<StringRef, 3> getValidEffectiveVersions() {
141+
return {{"3", "4", "5"}};
142142
};
143143
};
144144

lib/Basic/Version.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,16 @@ Optional<Version> Version::getEffectiveLanguageVersion() const {
319319
switch (Components[0]) {
320320
case 3:
321321
#ifdef SWIFT_VERSION_PATCHLEVEL
322-
return Version{3, 2, SWIFT_VERSION_PATCHLEVEL};
322+
return Version{3, 3, SWIFT_VERSION_PATCHLEVEL};
323323
#else
324-
return Version{3, 2};
324+
return Version{3, 3};
325325
#endif
326326
case 4:
327327
static_assert(SWIFT_VERSION_MAJOR == 4,
328328
"getCurrentLanguageVersion is no longer correct here");
329329
return Version::getCurrentLanguageVersion();
330+
case 5:
331+
return Version{5, 0};
330332
default:
331333
return None;
332334
}

lib/ClangImporter/ImportName.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ importer::nameVersionFromOptions(const LangOptions &langOpts) {
6565
return ImportNameVersion::Swift2;
6666
case 3:
6767
return ImportNameVersion::Swift3;
68+
// Fixme: Figure out the importing story for 5 instead of falling back to 4.
6869
case 4:
70+
case 5:
6971
return ImportNameVersion::Swift4;
7072
}
7173
}

test/Driver/swift-version-default.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ htn
2424
#endif
2525

2626
#if swift(>=4.1)
27-
aoeu
27+
aoeu // expected-error {{use of unresolved identifier}}
2828
#else
29-
htn // expected-error {{use of unresolved identifier}}
29+
htn
3030
#endif
3131

3232
#if swift(>=5)

test/Driver/swift-version.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@
77
// RUN: not %target-swiftc_driver -swift-version 3.0 %s 2>&1 | %FileCheck --check-prefix FIXIT_3 %s
88
// RUN: not %target-swiftc_driver -swift-version 3.3 %s 2>&1 | %FileCheck --check-prefix FIXIT_3 %s
99
// RUN: not %target-swiftc_driver -swift-version 4.3 %s 2>&1 | %FileCheck --check-prefix FIXIT_4 %s
10+
// RUN: not %target-swiftc_driver -swift-version 5.1 %s 2>&1 | %FileCheck --check-prefix FIXIT_5 %s
1011

1112
// RUN: not %target-swiftc_driver -swift-version 3 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_3 %s
1213
// RUN: not %target-swiftc_driver -swift-version 4 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_4 %s
14+
// RUN: not %target-swiftc_driver -swift-version 5 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_5 %s
1315

1416
// BAD: invalid value
15-
// BAD: note: valid arguments to '-swift-version' are '3', '4'
17+
// BAD: note: valid arguments to '-swift-version' are '3', '4', '5'
1618

1719
// FIXIT_3: use major version, as in '-swift-version 3'
1820
// FIXIT_4: use major version, as in '-swift-version 4'
21+
// FIXIT_5: use major version, as in '-swift-version 5'
1922

2023

2124
#if swift(>=3)
2225
asdf
2326
// ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
2427
// ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}}
28+
// ERROR_5: [[@LINE-3]]:1: error: {{use of unresolved identifier}}
2529
#else
2630
jkl
2731
#endif
@@ -30,26 +34,31 @@ jkl
3034
asdf
3135
// ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
3236
// ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}}
37+
// ERROR_5: [[@LINE-3]]:1: error: {{use of unresolved identifier}}
3338
#else
3439
jkl
3540
#endif
3641

3742
#if swift(>=4)
38-
asdf // ERROR_4: [[@LINE]]:1: error: {{use of unresolved identifier}}
43+
asdf
44+
// ERROR_4: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
45+
// ERROR_5: [[@LINE-2]]:1: error: {{use of unresolved identifier}}
3946
#else
4047
jkl // ERROR_3: [[@LINE]]:1: error: {{use of unresolved identifier}}
4148
#endif
4249

4350
#if swift(>=4.1)
4451
asdf
52+
// ERROR_4: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
53+
// ERROR_5: [[@LINE-2]]:1: error: {{use of unresolved identifier}}
4554
#else
4655
jkl
4756
// ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
48-
// ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}}
4957
#endif
5058

5159
#if swift(>=5)
5260
asdf
61+
// ERROR_5: [[@LINE-1]]:1: error: {{use of unresolved identifier}}
5362
#else
5463
jkl
5564
// ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}}

test/Parse/ConditionalCompilation/language_version_explicit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#endif
2323

2424
#if swift(>=4.0.1)
25+
let z = 1
26+
#else
2527
// This shouldn't emit any diagnostics.
2628
asdf asdf asdf asdf
27-
#else
28-
let z = 1
2929
#endif
3030

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Sub: Base {
1414

1515
// CHECK-CRASH: error: fatal error encountered while reading from module 'Lib'; please file a bug report with your project and the crash log
1616
// CHECK-CRASH-3-NOT: note
17-
// CHECK-CRASH-4: note: compiling as Swift 4.0, with 'Lib' built as Swift 3.2
17+
// CHECK-CRASH-4: note: compiling as Swift 4.1, with 'Lib' built as Swift 3.3
1818
// CHECK-CRASH-LABEL: *** DESERIALIZATION FAILURE (please include this section in any bug report) ***
1919
// CHECK-CRASH: could not find 'disappearingMethod()' in parent class
2020
// CHECK-CRASH: While loading members for 'Sub' in module 'Lib'

test/Serialization/Recovery/types-4-to-3.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import Lib
1616
func requiresConformance(_: B_RequiresConformance<B_ConformsToProto>) {}
1717
func requiresConformance(_: B_RequiresConformance<C_RelyOnConformanceImpl.Assoc>) {}
1818

19-
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 4.0) because it has overridable members that could not be loaded in Swift 3.2}}
20-
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 4.0) because it has requirements that could not be loaded in Swift 3.2}}
19+
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 4.1) because it has overridable members that could not be loaded in Swift 3.3}}
20+
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 4.1) because it has requirements that could not be loaded in Swift 3.3}}
2121

2222
#else // TEST
2323

utils/build-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ iterations with -O",
20722072
"--swift-user-visible-version",
20732073
help="User-visible version of the embedded Swift compiler",
20742074
type=arguments.type.swift_compiler_version,
2075-
default="4.0",
2075+
default="4.1",
20762076
metavar="MAJOR.MINOR")
20772077

20782078
parser.add_argument(

0 commit comments

Comments
 (0)