Skip to content

Member.baseElement is used inconsistently #29600

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

Closed
bwilkerson opened this issue May 11, 2017 · 2 comments
Closed

Member.baseElement is used inconsistently #29600

bwilkerson opened this issue May 11, 2017 · 2 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

Comments

@bwilkerson
Copy link
Member

I don't know whether this is causing any bugs, but the method Member.baseElement is being used in a seemingly inconsistent way. It appears that some of the code expects that baseElement will always return a non-member and that other code is careful to invoke baseElement until it returns a non-member. The getter, as things are currently implemented, is not required to return a non-member. We should (a) clearly document the expected behavior of the getter (whether the current behavior or a strictly non-member implementation) and (b) check the current invocation sites to make sure they're consistent with the decided on implementation.

@bwilkerson bwilkerson added legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable labels May 11, 2017
@jcollins-g
Copy link
Contributor

This showed up in dartdoc as difficulty resolving some comment references as we expected baseElement to always return a non-Member.

@jcollins-g
Copy link
Contributor

Some more details: The reason it created a bug for dartdoc was we have linkages to specific elements and are doing comparisons saying essentially "if(memberThingy.baseElement == this.element) { hurray() }". It's a way to leverage analyzer's canonicalization and easily enough corrected by a loop to get baseElements until we have a non-Member.

If analyzer is doing anything like these comparisons internally (or if its users are), that seems to me to be the likeliest sort of bug this would cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable
Projects
None yet
Development

No branches or pull requests

3 participants