Skip to content

SONARPY-618 Introduce Ambiguous Symbol#663

Merged
andrea-guarino-sonarsource merged 2 commits into
masterfrom
SONARPY-618b
Apr 2, 2020
Merged

SONARPY-618 Introduce Ambiguous Symbol#663
andrea-guarino-sonarsource merged 2 commits into
masterfrom
SONARPY-618b

Conversation

@andrea-guarino-sonarsource

Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could find a better name, e.g. alternatives()? I'm not sure it's really better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we initialize this field in the constructor and remove this method?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call setSymbolsByDeclarationTree?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like changing symbols at this point. It seems very late. What are the risks that we end up with a graph of symbols which doesn't make sense? Aren't we changing symbols which are referenced by other symbols?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should find a way to do that differently, without needing AmbiguousSymbolImpl to store symbolsByDeclarationTree.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One idea:
Add a symbol method to FunctionDefImpl. This symbol could be different from the symbol attached to the name of the function in the case of an ambiguous symbol.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I will go for it! Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this condition is not sufficient. We end up creating an ambiguous symbol in the following case and I suppose we should not:

x = 42
x = 43

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll update the condition to also check the presence of a usage of kind FUNC_DECLARATION or CLASS_DECLARATION

@sonarsource-next

Copy link
Copy Markdown

Kudos, SonarQube Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

95.3% 95.3% Coverage
0.0% 0.0% Duplication

@andrea-guarino-sonarsource andrea-guarino-sonarsource merged commit afb7450 into master Apr 2, 2020
@andrea-guarino-sonarsource andrea-guarino-sonarsource deleted the SONARPY-618b branch April 2, 2020 14:52
hashicorp-vault-sonar-prod Bot pushed a commit that referenced this pull request Nov 28, 2025
…buf (#663)

GitOrigin-RevId: c922c1b9578d323b36e5f39c7801c8354e1976f7
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.

3 participants