Skip to content

Fix member lookups for inherited members #11821

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

Conversation

BarkingBad
Copy link
Contributor

@BarkingBad BarkingBad commented Mar 19, 2021

@BarkingBad BarkingBad linked an issue Mar 19, 2021 that may be closed by this pull request
@BarkingBad BarkingBad force-pushed the scaladoc/fix-member-lookups branch from e98d9ef to 76aec60 Compare March 19, 2021 17:48
}.orElse {
val symbol = owner.memberField(qs.head)
Option.when(symbol != dotty.tools.dotc.core.Symbols.NoSymbol)(symbol).map((_, Some(owner)))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, it seems that the code we had previously didn't actually look up inherited members at all? In that case it'll have to be changed. We don't want to simply go through Scala Reflect functions here, we also need to take into account absent symbols (see hackIsNotAbsent).

This code also doesn't seem to work when the inherited symbol is in the middle of the query. In general it'd be better to modify localLookup instead of downwardLookup.

pk.flatMap(downwardLookup(qs, _))
.orElse(tp.flatMap(downwardLookup(qs, _)))
.orElse(tp.flatMap(downwardLookUpForInheritedMembers(qs, _)))
.orElse(tm.flatMap(downwardLookup(qs, _)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Inherited symbols can also appear in term symbols (objects, that is).

@abgruszecki
Copy link
Contributor

Closing in favour of #11850.

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.

Doctool: lookup inherited members
2 participants