File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -786,6 +786,9 @@ class Symbol {
786
786
inline Symbol &GetUltimate ();
787
787
inline const Symbol &GetUltimate () const ;
788
788
789
+ // Get the specific procedure from a potential generic symbol.
790
+ inline const Symbol *GetUltimateGeneric () const ;
791
+
789
792
inline DeclTypeSpec *GetType ();
790
793
inline const DeclTypeSpec *GetType () const ;
791
794
void SetType (const DeclTypeSpec &);
@@ -985,6 +988,16 @@ inline const Symbol &Symbol::GetUltimate() const {
985
988
}
986
989
}
987
990
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
+
988
1001
inline DeclTypeSpec *Symbol::GetType () {
989
1002
return const_cast <DeclTypeSpec *>(
990
1003
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) {
5644
5644
NoteInterfaceName(*name);
5645
5645
}
5646
5646
}
5647
+
5647
5648
void DeclarationVisitor::Post(const parser::ProcDecl &x) {
5648
5649
const auto &name{std::get<parser::Name>(x.t)};
5649
5650
const Symbol *procInterface{nullptr};
5650
5651
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()
5653
5655
: interfaceName_->symbol;
5654
5656
}
5655
5657
auto attrs{HandleSaveName(name.source, GetAttrs())};
You can’t perform that action at this time.
0 commit comments