File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -786,6 +786,9 @@ class Symbol {
786786 inline Symbol &GetUltimate ();
787787 inline const Symbol &GetUltimate () const ;
788788
789+ // Get the specific procedure from a potential generic symbol.
790+ inline const Symbol *GetUltimateGeneric () const ;
791+
789792 inline DeclTypeSpec *GetType ();
790793 inline const DeclTypeSpec *GetType () const ;
791794 void SetType (const DeclTypeSpec &);
@@ -985,6 +988,16 @@ inline const Symbol &Symbol::GetUltimate() const {
985988 }
986989}
987990
991+ inline const Symbol *Symbol::GetUltimateGeneric () const {
992+ if (this ->has <GenericDetails>())
993+ return this ;
994+ if (const auto *details{detailsIf<UseDetails>()})
995+ return details->symbol ().GetUltimateGeneric ();
996+ if (const auto *details{detailsIf<HostAssocDetails>()})
997+ return details->symbol ().GetUltimateGeneric ();
998+ return nullptr ;
999+ }
1000+
9881001inline DeclTypeSpec *Symbol::GetType () {
9891002 return const_cast <DeclTypeSpec *>(
9901003 const_cast <const Symbol *>(this )->GetType ());
Original file line number Diff line number Diff line change @@ -5644,12 +5644,14 @@ void DeclarationVisitor::Post(const parser::ProcInterface &x) {
56445644 NoteInterfaceName (*name);
56455645 }
56465646}
5647+
56475648void DeclarationVisitor::Post (const parser::ProcDecl &x) {
56485649 const auto &name{std::get<parser::Name>(x.t )};
56495650 const Symbol *procInterface{nullptr };
56505651 if (interfaceName_) {
5651- procInterface = interfaceName_->symbol ->has <GenericDetails>()
5652- ? interfaceName_->symbol ->get <GenericDetails>().specific ()
5652+ const Symbol *ultimateGeneric{interfaceName_->symbol ->GetUltimateGeneric ()};
5653+ procInterface = ultimateGeneric
5654+ ? ultimateGeneric->get <GenericDetails>().specific ()
56535655 : interfaceName_->symbol ;
56545656 }
56555657 auto attrs{HandleSaveName (name.source , GetAttrs ())};
You can’t perform that action at this time.
0 commit comments