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

Prefer ownersIterator #10713

Open
wants to merge 2 commits into
base: 2.13.x
Choose a base branch
from
Open

Conversation

som-snytt
Copy link
Contributor

When using ownerChain to search, prefer ownersIterator to creating and discarding a list.

A find may not even examine all owners.

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Mar 14, 2024
@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Mar 14, 2024
@som-snytt
Copy link
Contributor Author

It would be nice to demonstrate actual benefit.

It would be nice if it could be automated. Possibly "eliminate intermediate collection" is just "insert .view", except ownerChain is not a standard operation.

It's nice that the lint in 2.13.13 works (if backticks are removed):

[warn] .../scala/src/scaladoc/scala/tools/nsc/doc/model/ModelFactoryTypeSupport.scala:134:22: Name bSym is already introduced in an enclosing scope as value bSym at line 81. Did you intend to match it using backquoted `bSym`?
[warn]                 case bSym => false
[warn]                      ^

@som-snytt som-snytt marked this pull request as ready for review April 11, 2024 14:21
@som-snytt
Copy link
Contributor Author

Noticed an ancient commit for this change, so it's a forever issue. Maybe the API should be LazyList, or it really needs hasTransOwnerWhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
3 participants