Skip to content

Commit 470fbc7

Browse files
elshbeccadax
andauthored
Update lib/Parse/ParseDecl.cpp
Co-authored-by: Becca Royal-Gordon <[email protected]>
1 parent 757e3b1 commit 470fbc7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4823,12 +4823,13 @@ ParserResult<ImportDecl> Parser::parseDeclImport(ParseDeclOptions Flags,
48234823
// and check that the module alias appeared in source files instead of
48244824
// its corresponding real name
48254825
auto parsedModuleID = importPath.get().front().Item;
4826-
auto checkResult = Context.getRealModuleNameOrAlias(parsedModuleID);
4827-
if (!checkResult.second) {
4826+
if (Context.getRealModuleName(parsedModuleID).empty()) {
48284827
// If reached here, it means the parsed module name is a real module name
48294828
// which appeared in the source file; only a module alias should be allowed
4830-
diagnose(importPath.front().Loc, diag::expected_module_alias)
4831-
.fixItReplace(importPath.front().Loc, checkResult.first.str());
4829+
auto aliasName = Context.getRealModuleName(parsedModuleID, /*lookupAliasFromReal=*/true);
4830+
diagnose(importPath.front().Loc, diag::expected_module_alias,
4831+
parsedModuleID, aliasName)
4832+
.fixItReplace(importPath.front().Loc, aliasName.str());
48324833
return nullptr;
48334834
}
48344835

0 commit comments

Comments
 (0)