mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #36928 from eeckstein/module-build-error-message
ModuleInterfaceBuilder: give a more specific error message in case of a compiler mismatch
This commit is contained in:
@@ -728,6 +728,10 @@ ERROR(module_interface_build_failed,Fatal,
|
||||
"the textual interface may be broken by project issues"
|
||||
"%select{, differences between compilers (the producer '%3' and this compiler '%4')|}2 or a compiler bug",
|
||||
(bool, StringRef, bool, StringRef, StringRef))
|
||||
ERROR(module_interface_build_failed_mismatching_compiler,Fatal,
|
||||
"failed to build module '%0'; this SDK is not supported by the compiler "
|
||||
"(the SDK is built with '%1', while this compiler is '%2'). Please select a toolchain which matches the SDK.",
|
||||
(StringRef, StringRef, StringRef))
|
||||
ERROR(serialization_malformed_module,Fatal,
|
||||
"malformed compiled module: %0", (StringRef))
|
||||
ERROR(serialization_module_too_new,Fatal,
|
||||
|
||||
@@ -210,9 +210,14 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal(
|
||||
getSwiftInterfaceCompilerVersionForCurrentCompiler(
|
||||
SubInstance.getASTContext());
|
||||
StringRef emittedByCompiler = info.CompilerVersion;
|
||||
diagnose(diag::module_interface_build_failed, isTypeChecking,
|
||||
moduleName, emittedByCompiler == builtByCompiler,
|
||||
emittedByCompiler, builtByCompiler);
|
||||
if (!isTypeChecking && emittedByCompiler != builtByCompiler) {
|
||||
diagnose(diag::module_interface_build_failed_mismatching_compiler,
|
||||
moduleName, emittedByCompiler, builtByCompiler);
|
||||
} else {
|
||||
diagnose(diag::module_interface_build_failed, isTypeChecking,
|
||||
moduleName, emittedByCompiler == builtByCompiler,
|
||||
emittedByCompiler, builtByCompiler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import UnbuildableCurrent
|
||||
// CURRENT: unbuildable.swift:[[@LINE-1]]:8: error: failed to build module 'UnbuildableCurrent' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
|
||||
#else
|
||||
import UnbuildableFuture
|
||||
// FUTURE: unbuildable.swift:[[@LINE-1]]:8: error: failed to build module 'UnbuildableFuture' for importation due to the errors above; the textual interface may be broken by project issues, differences between compilers (the producer 'NeoTokyoSwift 2000.42' and this compiler '{{.*Swift version.*}}') or a compiler bug
|
||||
// FUTURE: unbuildable.swift:[[@LINE-1]]:8: error: failed to build module 'UnbuildableFuture'; this SDK is not supported by the compiler (the SDK is built with 'NeoTokyoSwift 2000.42', while this compiler is '{{.*Swift version.*}}'). Please select a toolchain which matches the SDK.
|
||||
#endif
|
||||
|
||||
// CURRENT-VERIFY: UnbuildableCurrent.swiftinterface:1:1: error: failed to verify module interface of 'UnbuildableCurrent' due to the errors above; the textual interface may be broken by project issues or a compiler bug
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
import ImportsOverlay
|
||||
|
||||
// CHECK: HasOverlay.swiftinterface:1:1: error: failed to build module 'HasOverlay' for importation due to the errors above; the textual interface may be broken by project issues, differences between compilers (the producer '(unspecified, file possibly handwritten)' and this compiler '{{.*Swift version.*}}') or a compiler bug
|
||||
// CHECK: HasOverlay.swiftinterface:1:1: error: failed to build module 'HasOverlay'; this SDK is not supported by the compiler (the SDK is built with '(unspecified, file possibly handwritten)', while this compiler is '{{.*Swift version.*}}'). Please select a toolchain which matches the SDK.
|
||||
|
||||
Reference in New Issue
Block a user