This is an archive of the discontinued LLVM Phabricator instance.

[flang] Don't resolve names in derived type definitions to generics
ClosedPublic

Authored by klausler on Sep 21 2022, 4:45 PM.

Details

Summary

There's code in name resolution that handles resolution of references
that appear in the definitions of derived types -- it checks for
existing components in the type being defined, as well as for
non-parent components in its ancestors. Special case code prevents
resolution of a name to the symbol of a procedure binding. This
code needs to be extended so that names of generic procedures
are similarly prevented from shadowing symbols in the scope around
the type.

Diff Detail

Event Timeline

klausler created this revision.Sep 21 2022, 4:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2022, 4:45 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Sep 21 2022, 4:45 PM

@klausler is it possible to write a LIT test for this? Can you please add one?

@klausler is it possible to write a LIT test for this? Can you please add one?

I didn't think that this case merited one, but I'll extract one for you.

klausler updated this revision to Diff 462063.Sep 21 2022, 6:58 PM

Add test.

vzakhari accepted this revision.Sep 21 2022, 10:20 PM

Thank you for the test! If I understand it correctly, this allows resolving foo inside ext to the module's subroutine foo rather than to the generic identifier foo inside base.
LGTM

This revision is now accepted and ready to land.Sep 21 2022, 10:20 PM
This revision was landed with ongoing or failed builds.Sep 23 2022, 10:56 AM
This revision was automatically updated to reflect the committed changes.