forked from OSchip/llvm-project
[flang] Fix regression from generic fix
A recent change that corrected the name resolution of a generic interface when the same name was visible in scope incorrectly prevented a local generic from shadowing an outer name that is not a generic, subprogram, or derived type -- e.g., a simple variable -- leading to an inappropriate error message. Differential Revision: https://reviews.llvm.org/D124276
This commit is contained in:
parent
ee285faed2
commit
bf8f9b35c1
|
@ -6962,16 +6962,18 @@ void ResolveNamesVisitor::CreateGeneric(const parser::GenericSpec &x) {
|
|||
info.Resolve(existing);
|
||||
return;
|
||||
}
|
||||
if (ultimate.has<SubprogramDetails>() ||
|
||||
ultimate.has<SubprogramNameDetails>()) {
|
||||
genericDetails.set_specific(ultimate);
|
||||
} else if (ultimate.has<DerivedTypeDetails>()) {
|
||||
genericDetails.set_derivedType(ultimate);
|
||||
} else {
|
||||
SayAlreadyDeclared(symbolName, *existing);
|
||||
return;
|
||||
if (&existing->owner() == &currScope()) {
|
||||
if (ultimate.has<SubprogramDetails>() ||
|
||||
ultimate.has<SubprogramNameDetails>()) {
|
||||
genericDetails.set_specific(ultimate);
|
||||
} else if (ultimate.has<DerivedTypeDetails>()) {
|
||||
genericDetails.set_derivedType(ultimate);
|
||||
} else {
|
||||
SayAlreadyDeclared(symbolName, *existing);
|
||||
return;
|
||||
}
|
||||
EraseSymbol(*existing);
|
||||
}
|
||||
EraseSymbol(*existing);
|
||||
}
|
||||
info.Resolve(&MakeSymbol(symbolName, Attrs{}, std::move(genericDetails)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue