diff --git a/CMakeLists.txt b/CMakeLists.txt index c0306ccb76c19..3a4bb3a033637 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ set_property(CACHE SWIFT_ANALYZE_CODE_COVERAGE PROPERTY # SWIFT_VERSION is deliberately /not/ cached so that an existing build directory # can be reused when a new version of Swift comes out (assuming the user hasn't # manually set it as part of their own CMake configuration). -set(SWIFT_VERSION "4.0") +set(SWIFT_VERSION "4.1") set(SWIFT_VENDOR "" CACHE STRING "The vendor name of the Swift compiler") diff --git a/docs/Testing.md b/docs/Testing.md index 15af92e7a602b..b417eb4124b7d 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -419,7 +419,7 @@ FIXME: full list. * ``optimized_stdlib_``: an optimized stdlib plus cpu configuration. -* ``SWIFT_VERSION=``: restricts a test to Swift 3 or Swift 4. If you +* ``SWIFT_VERSION=``: restricts a test to Swift 3, Swift 4, Swift 5. If you need to use this, make sure to add a test for the other version as well unless you are specifically testing ``-swift-version``-related functionality. diff --git a/include/swift/Basic/Version.h b/include/swift/Basic/Version.h index 8bcaf02083625..1519536896e81 100644 --- a/include/swift/Basic/Version.h +++ b/include/swift/Basic/Version.h @@ -137,8 +137,8 @@ class Version { // Whitelist of backward-compatibility versions that we permit passing as // -swift-version - static std::array getValidEffectiveVersions() { - return {{"3", "4"}}; + static std::array getValidEffectiveVersions() { + return {{"3", "4", "5"}}; }; }; diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp index f99ce28659d70..e363a303a81b3 100644 --- a/lib/Basic/Version.cpp +++ b/lib/Basic/Version.cpp @@ -319,14 +319,16 @@ Optional Version::getEffectiveLanguageVersion() const { switch (Components[0]) { case 3: #ifdef SWIFT_VERSION_PATCHLEVEL - return Version{3, 2, SWIFT_VERSION_PATCHLEVEL}; + return Version{3, 3, SWIFT_VERSION_PATCHLEVEL}; #else - return Version{3, 2}; + return Version{3, 3}; #endif case 4: static_assert(SWIFT_VERSION_MAJOR == 4, "getCurrentLanguageVersion is no longer correct here"); return Version::getCurrentLanguageVersion(); + case 5: + return Version{5, 0}; default: return None; } diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index 97a8dcfdf815a..b7a4adb14c186 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -65,7 +65,9 @@ importer::nameVersionFromOptions(const LangOptions &langOpts) { return ImportNameVersion::Swift2; case 3: return ImportNameVersion::Swift3; + // Fixme: Figure out the importing story for 5 instead of falling back to 4. case 4: + case 5: return ImportNameVersion::Swift4; } } diff --git a/test/Driver/swift-version-default.swift b/test/Driver/swift-version-default.swift index 4db2b19129c50..32fe7f663ec8b 100644 --- a/test/Driver/swift-version-default.swift +++ b/test/Driver/swift-version-default.swift @@ -24,9 +24,9 @@ htn #endif #if swift(>=4.1) -aoeu +aoeu // expected-error {{use of unresolved identifier}} #else -htn // expected-error {{use of unresolved identifier}} +htn #endif #if swift(>=5) diff --git a/test/Driver/swift-version.swift b/test/Driver/swift-version.swift index 129a2beb309d7..31ed2b48a7518 100644 --- a/test/Driver/swift-version.swift +++ b/test/Driver/swift-version.swift @@ -7,21 +7,25 @@ // RUN: not %target-swiftc_driver -swift-version 3.0 %s 2>&1 | %FileCheck --check-prefix FIXIT_3 %s // RUN: not %target-swiftc_driver -swift-version 3.3 %s 2>&1 | %FileCheck --check-prefix FIXIT_3 %s // RUN: not %target-swiftc_driver -swift-version 4.3 %s 2>&1 | %FileCheck --check-prefix FIXIT_4 %s +// RUN: not %target-swiftc_driver -swift-version 5.1 %s 2>&1 | %FileCheck --check-prefix FIXIT_5 %s // RUN: not %target-swiftc_driver -swift-version 3 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_3 %s // RUN: not %target-swiftc_driver -swift-version 4 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_4 %s +// RUN: not %target-swiftc_driver -swift-version 5 -typecheck %s 2>&1 | %FileCheck --check-prefix ERROR_5 %s // BAD: invalid value -// BAD: note: valid arguments to '-swift-version' are '3', '4' +// BAD: note: valid arguments to '-swift-version' are '3', '4', '5' // FIXIT_3: use major version, as in '-swift-version 3' // FIXIT_4: use major version, as in '-swift-version 4' +// FIXIT_5: use major version, as in '-swift-version 5' #if swift(>=3) asdf // ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}} // ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}} +// ERROR_5: [[@LINE-3]]:1: error: {{use of unresolved identifier}} #else jkl #endif @@ -30,26 +34,31 @@ jkl asdf // ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}} // ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}} +// ERROR_5: [[@LINE-3]]:1: error: {{use of unresolved identifier}} #else jkl #endif #if swift(>=4) -asdf // ERROR_4: [[@LINE]]:1: error: {{use of unresolved identifier}} +asdf +// ERROR_4: [[@LINE-1]]:1: error: {{use of unresolved identifier}} +// ERROR_5: [[@LINE-2]]:1: error: {{use of unresolved identifier}} #else jkl // ERROR_3: [[@LINE]]:1: error: {{use of unresolved identifier}} #endif #if swift(>=4.1) asdf +// ERROR_4: [[@LINE-1]]:1: error: {{use of unresolved identifier}} +// ERROR_5: [[@LINE-2]]:1: error: {{use of unresolved identifier}} #else jkl // ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}} -// ERROR_4: [[@LINE-2]]:1: error: {{use of unresolved identifier}} #endif #if swift(>=5) asdf +// ERROR_5: [[@LINE-1]]:1: error: {{use of unresolved identifier}} #else jkl // ERROR_3: [[@LINE-1]]:1: error: {{use of unresolved identifier}} diff --git a/test/Parse/ConditionalCompilation/language_version_explicit.swift b/test/Parse/ConditionalCompilation/language_version_explicit.swift index 81e0eaad35a27..5baef8ad9f3d4 100644 --- a/test/Parse/ConditionalCompilation/language_version_explicit.swift +++ b/test/Parse/ConditionalCompilation/language_version_explicit.swift @@ -22,9 +22,9 @@ #endif #if swift(>=4.0.1) + let z = 1 +#else // This shouldn't emit any diagnostics. asdf asdf asdf asdf -#else - let z = 1 #endif diff --git a/test/Serialization/Recovery/crash-recovery.swift b/test/Serialization/Recovery/crash-recovery.swift index 733375ad471fa..aecd4d26e3b3a 100644 --- a/test/Serialization/Recovery/crash-recovery.swift +++ b/test/Serialization/Recovery/crash-recovery.swift @@ -14,7 +14,7 @@ public class Sub: Base { // CHECK-CRASH: error: fatal error encountered while reading from module 'Lib'; please file a bug report with your project and the crash log // CHECK-CRASH-3-NOT: note -// CHECK-CRASH-4: note: compiling as Swift 4.0, with 'Lib' built as Swift 3.2 +// CHECK-CRASH-4: note: compiling as Swift 4.1, with 'Lib' built as Swift 3.3 // CHECK-CRASH-LABEL: *** DESERIALIZATION FAILURE (please include this section in any bug report) *** // CHECK-CRASH: could not find 'disappearingMethod()' in parent class // CHECK-CRASH: While loading members for 'Sub' in module 'Lib' diff --git a/test/Serialization/Recovery/types-4-to-3.swift b/test/Serialization/Recovery/types-4-to-3.swift index ca540c1b3812e..380c3d097977a 100644 --- a/test/Serialization/Recovery/types-4-to-3.swift +++ b/test/Serialization/Recovery/types-4-to-3.swift @@ -16,8 +16,8 @@ import Lib func requiresConformance(_: B_RequiresConformance) {} func requiresConformance(_: B_RequiresConformance) {} -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}} -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}} +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}} +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}} #else // TEST diff --git a/utils/build-script b/utils/build-script index 515728526e816..be142150a7ebd 100755 --- a/utils/build-script +++ b/utils/build-script @@ -2072,7 +2072,7 @@ iterations with -O", "--swift-user-visible-version", help="User-visible version of the embedded Swift compiler", type=arguments.type.swift_compiler_version, - default="4.0", + default="4.1", metavar="MAJOR.MINOR") parser.add_argument(