Skip to content
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

Merged
merged 3 commits into from Sep 16, 2019
Merged

Fix bug merging generics on USE #741

merged 3 commits into from Sep 16, 2019

Conversation

tskeith
Copy link
Collaborator

@tskeith tskeith commented Sep 13, 2019

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.

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 Show resolved Hide resolved
lib/semantics/symbol.cc Show resolved Hide resolved
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)};
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.
Copy link
Collaborator

@jeanPerier jeanPerier left a 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

@tskeith tskeith merged commit 5cedc81 into master Sep 16, 2019
@tskeith tskeith deleted the tsk-issue733 branch September 16, 2019 14:31
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
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
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
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
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
swift-ci pushed a commit to apple/llvm-project that referenced this pull request Apr 9, 2020
…/tsk-issue733

Fix bug merging generics on USE

Original-commit: flang-compiler/f18@5cedc81
Reviewed-on: flang-compiler/f18#741
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
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
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
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
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants