Skip to content

Commit aaf6f4e

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 46f7e19 + 2c40c6b commit aaf6f4e

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,8 @@ ERROR(serialization_module_too_new,Fatal,
588588
"module file was created by a newer version of the compiler: %0",
589589
(StringRef))
590590
ERROR(serialization_module_language_version_mismatch,Fatal,
591-
"module compiled with Swift %0 cannot be imported in Swift %1: %2",
591+
"module compiled with Swift %0 cannot be imported by the Swift %1 "
592+
"compiler: %2",
592593
(StringRef, StringRef, StringRef))
593594
ERROR(serialization_module_too_old,Fatal,
594595
"module file was created by an older version of the compiler; "

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <system_error>
2828

2929
using namespace swift;
30+
using swift::version::Version;
3031

3132
namespace {
3233
using AccessPathElem = std::pair<Identifier, SourceLoc>;
@@ -293,7 +294,7 @@ FileUnit *SerializedModuleLoader::loadAST(
293294

294295
SmallString<32> versionBuf;
295296
llvm::raw_svector_ostream versionString(versionBuf);
296-
versionString << Ctx.LangOpts.EffectiveLanguageVersion;
297+
versionString << Version::getCurrentLanguageVersion();
297298
if (versionString.str() == shortVersion)
298299
return false;
299300

test/Serialization/version-mismatches.swift

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-old/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix TOO-OLD %s
22
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix TOO-NEW %s
33

4-
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-old-language/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
5-
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
6-
74
// Update this line when "-swift-version 3" is no longer supported.
8-
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal -swift-version 3 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE-3 %s
9-
// Update this line when "-swift-version 4" is no longer supported.
10-
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal -swift-version 4 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE-4 %s
5+
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal -swift-version 3 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
6+
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal -swift-version 4 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
7+
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal -swift-version 5 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
8+
9+
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs/too-old-language/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
1110

1211
import Library
1312
// TOO-OLD: :[[@LINE-1]]:8: error: module file was created by an older version of the compiler; rebuild 'Library' and try again: {{.*}}too-old/Library.swiftmodule{{$}}
1413
// TOO-NEW: :[[@LINE-2]]:8: error: module file was created by a newer version of the compiler: {{.*}}too-new/Library.swiftmodule{{$}}
1514

16-
// Update this line when the default language version changes
17-
// LANGUAGE: :[[@LINE-5]]:8: error: module compiled with Swift X.Y cannot be imported in Swift {{.+}}.{{.+}}: {{.*}}too-{{old|new}}-language/Library.swiftmodule{{$}}
18-
19-
// Update this line when "-swift-version 3" is no longer supported.
20-
// LANGUAGE-3: :[[@LINE-8]]:8: error: module compiled with Swift X.Y cannot be imported in Swift 3.{{.+}}: {{.*}}too-{{old|new}}-language/Library.swiftmodule{{$}}
21-
// Update this line when "-swift-version 3" is no longer supported.
22-
// LANGUAGE-4: :[[@LINE-10]]:8: error: module compiled with Swift X.Y cannot be imported in Swift 4.{{.+}}: {{.*}}too-{{old|new}}-language/Library.swiftmodule{{$}}
15+
// Update this line when the compiler version changes.
16+
// LANGUAGE: :[[@LINE-5]]:8: error: module compiled with Swift X.Y cannot be imported by the Swift 4.{{.+}} compiler: {{.*}}too-{{old|new}}-language/Library.swiftmodule{{$}}
2317

2418
// Compiler thinks that the module is empty in all cases.
2519
// CHECK: :[[@LINE+1]]:1: error: module 'Library' has no member named 'foo'

0 commit comments

Comments
 (0)