Skip to content

Commit b1e0b89

Browse files
committed
[Serialization] Invert order of diagnostics in forced recovery mode
1 parent 1cd4f4a commit b1e0b89

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,10 @@ NOTE(modularization_issue_side_effect_type_error,none,
893893
"could not deserialize type for %0",
894894
(DeclName))
895895

896-
WARNING(modularization_issue_worked_around,none,
897-
"attempting forced recovery enabled by -experimental-force-workaround-broken-modules",
898-
())
896+
NOTE(modularization_issue_worked_around,none,
897+
"attempting forced recovery enabled by "
898+
"-experimental-force-workaround-broken-modules",
899+
())
899900

900901
ERROR(reserved_member_name,none,
901902
"type member must not be named %0, since it would conflict with the"

lib/Serialization/Deserialization.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,13 +2059,13 @@ ModuleFile::resolveCrossReference(ModuleID MID, uint32_t pathLen) {
20592059
if (getContext().LangOpts.ForceWorkaroundBrokenModules &&
20602060
errorKind == ModularizationError::Kind::DeclMoved &&
20612061
!values.empty()) {
2062-
// Print the error as a remark and notify of the recovery attempt.
2063-
getContext().Diags.diagnose(getSourceLoc(),
2064-
diag::modularization_issue_worked_around);
2062+
// Print the error as a warning and notify of the recovery attempt.
20652063
llvm::handleAllErrors(std::move(error),
20662064
[&](const ModularizationError &modularError) {
2067-
modularError.diagnose(this, DiagnosticBehavior::Note);
2065+
modularError.diagnose(this, DiagnosticBehavior::Warning);
20682066
});
2067+
getContext().Diags.diagnose(getSourceLoc(),
2068+
diag::modularization_issue_worked_around);
20692069
} else {
20702070
return std::move(error);
20712071
}

test/Serialization/modularization-error.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
// RUN: %target-swift-frontend -emit-sil %t/LibWithXRef.swiftmodule -module-name LibWithXRef -I %t \
1919
// RUN: -experimental-force-workaround-broken-modules 2>&1 \
2020
// RUN: | %FileCheck --check-prefixes CHECK-WORKAROUND %s
21-
// CHECK-WORKAROUND: warning: attempting forced recovery enabled by -experimental-force-workaround-broken-modules
22-
// CHECK-WORKAROUND: note: reference to type 'MyType' broken by a context change; 'MyType' was expected to be in 'A', but now a candidate is found only in 'B'
21+
// CHECK-WORKAROUND: LibWithXRef.swiftmodule:1:1: warning: reference to type 'MyType' broken by a context change; 'MyType' was expected to be in 'A', but now a candidate is found only in 'B'
22+
// CHECK-WORKAROUND: LibWithXRef.swiftmodule:1:1: note: attempting forced recovery enabled by -experimental-force-workaround-broken-modules
2323
// CHECK-WORKAROUND: func foo() -> some Proto
2424

2525
/// Change MyType into a function.

0 commit comments

Comments
 (0)