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

CheckUnused checks span.exists before testing its parts #22504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Feb 3, 2025

Must check span.exists before using start or point.

Can use pointDelta safely.

It's not obvious that certain checks for isSynthetic should require exists, since those tests will not pass for unpositioned trees. (todo)

Needs a test for producing unpositioned Ident. (todo)

Also restore alias "unsafe-warn-patvars". Fix typo in other description.

Fixes #22499

@som-snytt
Copy link
Contributor Author

The hosted runner: GitHub Actions 13 lost communication with the server. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

That's called blaming the victim.

@som-snytt som-snytt force-pushed the issue/22499-check-nospan branch 2 times, most recently from bb86c49 to 27224a4 Compare February 4, 2025 17:44
@som-snytt som-snytt marked this pull request as ready for review February 5, 2025 01:22
@Gedochao Gedochao requested a review from Linyxus February 13, 2025 07:42
Copy link
Contributor

@Linyxus Linyxus left a comment

Choose a reason for hiding this comment

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

The only thing seems to be missing is an accompanying test case. I see that it is left as a todo in the description, what is the status on that? Otherwise LGTM! 👍

@som-snytt
Copy link
Contributor Author

som-snytt commented Feb 14, 2025

The (any: @unchecked).isInstanceOf that is inlined from magnolia results in a tree.tpe with the annotation:

  override def transformTypeTree(tree: TypeTree)(using Context): tree.type =
    tree.tpe match
    case AnnotatedType(_, annot) => transformAllDeep(annot.tree)

The annot.tree has the spanless Ident.

Edit: that's what I did not yet reproduce in a dotty test. I assume (without evidence) that it's a bug to see a spanless tree. I suspected tasty, special handling of isInstanceOf, or tree copying for derived. Or "annotations are special".

By cosmic coincidence, it is the unchecked restored the other day in softwaremill/magnolia@5a030d8.

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.

Regression in CheckUnused leads to compiler crash
2 participants