Sema: Offer solution to silence inconsistent import access-level warnings

Adoption InternalImportsByDefault provides a safe access-level by default
to imports, as such ambiguities are not a risk and showing this warning is
superflous. When this warning is shown, make sure we note this alternative.
This commit is contained in:
Alexis Laferrière
2024-04-21 10:45:14 -07:00
parent f4d73275cb
commit bd9c385ce5
5 changed files with 16 additions and 3 deletions

View File

@@ -1075,11 +1075,16 @@ CheckInconsistentAccessLevelOnImport::evaluate(
auto &diags = mod->getDiags();
{
InFlightDiagnostic error =
diags.diagnose(implicitImport, diag::inconsistent_implicit_access_level_on_import,
implicitImport->getModule()->getName(), otherAccessLevel);
diags.diagnose(implicitImport,
diag::inconsistent_implicit_access_level_on_import,
implicitImport->getModule()->getName(),
otherAccessLevel);
error.fixItInsert(implicitImport->getStartLoc(),
diag::inconsistent_implicit_access_level_on_import_fixit,
otherAccessLevel);
error.flush();
diags.diagnose(implicitImport,
diag::inconsistent_implicit_access_level_on_import_silence);
}
SourceLoc accessLevelLoc = otherImport->getStartLoc();