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);
|
info.Resolve(existing);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ultimate.has<SubprogramDetails>() ||
|
if (&existing->owner() == &currScope()) {
|
||||||
ultimate.has<SubprogramNameDetails>()) {
|
if (ultimate.has<SubprogramDetails>() ||
|
||||||
genericDetails.set_specific(ultimate);
|
ultimate.has<SubprogramNameDetails>()) {
|
||||||
} else if (ultimate.has<DerivedTypeDetails>()) {
|
genericDetails.set_specific(ultimate);
|
||||||
genericDetails.set_derivedType(ultimate);
|
} else if (ultimate.has<DerivedTypeDetails>()) {
|
||||||
} else {
|
genericDetails.set_derivedType(ultimate);
|
||||||
SayAlreadyDeclared(symbolName, *existing);
|
} else {
|
||||||
return;
|
SayAlreadyDeclared(symbolName, *existing);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EraseSymbol(*existing);
|
||||||
}
|
}
|
||||||
EraseSymbol(*existing);
|
|
||||||
}
|
}
|
||||||
info.Resolve(&MakeSymbol(symbolName, Attrs{}, std::move(genericDetails)));
|
info.Resolve(&MakeSymbol(symbolName, Attrs{}, std::move(genericDetails)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue