mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Tweak diagnostic message when importing the current module.
Before: error: cannot import module being compiled After: warning: file 'foo.swift' is part of module 'Foo'; ignoring import rdar://problem/22635888 Swift SVN r31995
This commit is contained in:
@@ -150,8 +150,15 @@ void NameBinder::addImport(
|
||||
if (ID->getModulePath().front().first == SF.getParentModule()->getName() &&
|
||||
ID->getModulePath().size() == 1 && !shouldImportSelfImportClang(ID, SF)) {
|
||||
// If the imported module name is the same as the current module,
|
||||
// produce an error.
|
||||
Context.Diags.diagnose(ID, diag::sema_import_current_module);
|
||||
// produce a diagnostic.
|
||||
StringRef filename = llvm::sys::path::filename(SF.getFilename());
|
||||
if (filename.empty())
|
||||
Context.Diags.diagnose(ID, diag::sema_import_current_module,
|
||||
ID->getModulePath().front().first);
|
||||
else
|
||||
Context.Diags.diagnose(ID, diag::sema_import_current_module_with_file,
|
||||
filename, ID->getModulePath().front().first);
|
||||
ID->setModule(SF.getParentModule());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user