Skip to content

[5.9] ModuleLoader: emit a note when encountering a blocklisted module interface #67273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,10 @@ ERROR(need_cxx_interop_to_import_module,none,
NOTE(enable_cxx_interop_docs,none,
"visit https://www.swift.org/documentation/cxx-interop/project-build-setup to learn how to enable C++ interoperability", ())

NOTE(interface_block_listed_broken,none,
"textual interface for %0 is blocklisted as broken; "
"interface verification errors are downgraded to warnings", (StringRef))

ERROR(reserved_member_name,none,
"type member must not be named %0, since it would conflict with the"
" 'foo.%1' expression", (DeclName, StringRef))
Expand Down
12 changes: 8 additions & 4 deletions lib/Frontend/ModuleInterfaceBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,14 @@ bool ExplicitModuleInterfaceBuilder::collectDepsForSerialization(

static bool shouldDowngradeInterfaceVerificationError(const FrontendOptions &opts,
ASTContext &ctx) {
return opts.DowngradeInterfaceVerificationError ||
ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
BlockListKeyKind::ModuleName,
BlockListAction::DowngradeInterfaceVerificationFailure);
if (ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
BlockListKeyKind::ModuleName,
BlockListAction::DowngradeInterfaceVerificationFailure)) {
ctx.Diags.diagnose(SourceLoc(), diag::interface_block_listed_broken,
opts.ModuleName);
return true;
}
return opts.DowngradeInterfaceVerificationError;
}

std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
Expand Down
4 changes: 4 additions & 0 deletions test/ModuleInterface/blocklist_action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -downgrade-typecheck-interface-error
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml

// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml &> %t/notes.txt
// RUN: %FileCheck -check-prefix CHECK-NOTES --input-file %t/notes.txt %s
// CHECK-NOTES: note: textual interface for Test is blocklisted as broken; interface verification errors are downgraded to warnings

public func foo() {}