New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug merging generics on USE #741
Conversation
When we use-associate the same generic name from two different modules they are merged together. If the same specific procedure occurs in both generics it should only occur once in the merged one. Similarly, it's not an error if they both have a derived type or specific procedure named the same as the generic, as long as they are the same symbol. Fixes #733.
lib/semantics/symbol.cc
Outdated
auto &procs{from.specificProcs_}; | ||
specificProcs_.insert(specificProcs_.end(), procs.begin(), procs.end()); | ||
for (const Symbol *symbol : from.specificProcs_) { | ||
auto it{std::find(specificProcs_.begin(), specificProcs_.end(), symbol)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd bash these two lines together and avoid the needless temporary. Calling find
and comparing its result to end()
is idiomatic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
If a generic name is use-associated from two different modules and they both have a specific procedure or both have a derived type with the same name, report it as an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for addressing the comment
When we use-associate the same generic name from two different modules they are merged together. If the same specific procedure occurs in both generics it should only occur once in the merged one. Similarly, it's not an error if they both have a derived type or specific procedure named the same as the generic, as long as they are the same symbol. Fixes flang-compiler/f18#733. Original-commit: flang-compiler/f18@d37db07 Reviewed-on: flang-compiler/f18#741 Tree-same-pre-rewrite: false
If a generic name is use-associated from two different modules and they both have a specific procedure or both have a derived type with the same name, report it as an error. Original-commit: flang-compiler/f18@42369af Reviewed-on: flang-compiler/f18#741 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@134190f Reviewed-on: flang-compiler/f18#741
…/tsk-issue733 Fix bug merging generics on USE Original-commit: flang-compiler/f18@5cedc81 Reviewed-on: flang-compiler/f18#741
When we use-associate the same generic name from two different modules they are merged together. If the same specific procedure occurs in both generics it should only occur once in the merged one. Similarly, it's not an error if they both have a derived type or specific procedure named the same as the generic, as long as they are the same symbol. Fixes flang-compiler/f18#733. Original-commit: flang-compiler/f18@d37db07 Reviewed-on: flang-compiler/f18#741 Tree-same-pre-rewrite: false
If a generic name is use-associated from two different modules and they both have a specific procedure or both have a derived type with the same name, report it as an error. Original-commit: flang-compiler/f18@42369af Reviewed-on: flang-compiler/f18#741 Tree-same-pre-rewrite: false
Original-commit: flang-compiler/f18@134190f Reviewed-on: flang-compiler/f18#741
When we use-associate the same generic name from two different modules
they are merged together. If the same specific procedure occurs in both
generics it should only occur once in the merged one.
Similarly, it's not an error if they both have a derived type or
specific procedure named the same as the generic, as long as they are
the same symbol.
Fixes #733.