Skip to content

Commit 22e3cff

Browse files
committed
Tweak diagnostic for failed module interface verification
1 parent 5f523fe commit 22e3cff

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,12 @@ ERROR(sema_opening_import,Fatal,
701701
ERROR(serialization_load_failed,Fatal,
702702
"failed to load module '%0'", (StringRef))
703703
ERROR(module_interface_build_failed,Fatal,
704-
"failed to build module '%0' from its module interface; "
705-
"%select{the compiler that produced it, '%2', may have used features "
706-
"that aren't supported by this compiler, '%3'"
707-
"|it may have been damaged or it may have triggered a bug in the Swift "
708-
"compiler when it was produced}1",
709-
(StringRef, bool, StringRef, StringRef))
704+
"failed to %select{build module '%1' from its module interface|verify "
705+
"module interface of '%1'}0; %select{the compiler that produced it, "
706+
"'%3', may have used features that aren't supported by this compiler, "
707+
"'%4'|it may have been damaged or it may have triggered a bug in the "
708+
"Swift compiler when it was produced}2",
709+
(bool, StringRef, bool, StringRef, StringRef))
710710
ERROR(serialization_malformed_module,Fatal,
711711
"malformed compiled module: %0", (StringRef))
712712
ERROR(serialization_module_too_new,Fatal,

lib/Frontend/ModuleInterfaceBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal(
200200
getSwiftInterfaceCompilerVersionForCurrentCompiler(
201201
SubInstance.getASTContext());
202202
StringRef emittedByCompiler = info.CompilerVersion;
203-
diagnose(diag::module_interface_build_failed, moduleName,
204-
emittedByCompiler == builtByCompiler, emittedByCompiler,
205-
builtByCompiler);
203+
diagnose(diag::module_interface_build_failed, isTypeChecking,
204+
moduleName, emittedByCompiler == builtByCompiler,
205+
emittedByCompiler, builtByCompiler);
206206
}
207207
};
208208

test/ModuleInterface/unbuildable.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
//
2020
// Test that we get the same results when typechecking the interface:
2121
//
22-
// RUN: not %target-swift-frontend -typecheck-module-from-interface %t/UnbuildableCurrent.swiftinterface 2>&1 | %FileCheck -check-prefixes=ALL,CURRENT-PREBUILD %s
23-
// RUN: not %target-swift-frontend -typecheck-module-from-interface %t/UnbuildableFuture.swiftinterface 2>&1 | %FileCheck -check-prefixes=ALL,FUTURE-PREBUILD %s
22+
// RUN: not %target-swift-frontend -typecheck-module-from-interface %t/UnbuildableCurrent.swiftinterface 2>&1 | %FileCheck -check-prefixes=ALL,CURRENT-VERIFY %s
23+
// RUN: not %target-swift-frontend -typecheck-module-from-interface %t/UnbuildableFuture.swiftinterface 2>&1 | %FileCheck -check-prefixes=ALL,FUTURE-VERIFY %s
2424

2525
// ALL: Unbuildable{{[^.]+}}.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: use of unknown directive '#somethingYouveNeverHeardOf'
2626

@@ -32,5 +32,5 @@ import UnbuildableFuture
3232
// FUTURE: unbuildable.swift:[[@LINE-1]]:8: error: failed to build module 'UnbuildableFuture' from its module interface; the compiler that produced it, 'NeoTokyoSwift 2000.42', may have used features that aren't supported by this compiler, '{{.*Swift version.*}}'
3333
#endif
3434

35-
// CURRENT-PREBUILD: UnbuildableCurrent.swiftinterface:1:1: error: failed to build module 'UnbuildableCurrent' from its module interface; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced
36-
// FUTURE-PREBUILD: UnbuildableFuture.swiftinterface:1:1: error: failed to build module 'UnbuildableFuture' from its module interface; the compiler that produced it, 'NeoTokyoSwift 2000.42', may have used features that aren't supported by this compiler, '{{.*Swift version.*}}'
35+
// CURRENT-VERIFY: UnbuildableCurrent.swiftinterface:1:1: error: failed to verify module interface of 'UnbuildableCurrent'; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced
36+
// FUTURE-VERIFY: UnbuildableFuture.swiftinterface:1:1: error: failed to verify module interface of 'UnbuildableFuture'; the compiler that produced it, 'NeoTokyoSwift 2000.42', may have used features that aren't supported by this compiler, '{{.*Swift version.*}}'

test/ModuleInterface/verify-module-interfaces.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
public struct MyStruct {}
1313

1414
// CHECK: MyModule.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: use of unknown directive '#__debug_emit_invalid_swiftinterface_syntax__'
15-
// CHECK: MyModule.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: failed to build module 'MyModule' from its module interface; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced
15+
// CHECK: MyModule.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: failed to verify module interface of 'MyModule'; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced

0 commit comments

Comments
 (0)