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

Automatically fill in positions of trees based on their children. #351

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

sjrd
Copy link
Contributor

@sjrd sjrd commented Sep 27, 2023

When pickling, dotc does not store the span of trees for which it is the same as the union of the spans of its children.

In order to recover those, we now have an internal "auto" mode of SourcePosition, which stores the SourceFile but with NoSpan. When building a Tree, if it is given an "auto" position, we compute the span based on its children. We mimick the formula used by dotc to do so, but only upward (dotc also does some weird mutating downward propagation, but AFAICT it will always store the spans of leaf trees, so we don't need that).

When pickling, dotc does not store the span of trees for which it
is the same as the union of the spans of its children.

In order to recover those, we now have an internal "auto" mode of
`SourcePosition`, which stores the `SourceFile` but with `NoSpan`.
When building a `Tree`, if it is given an "auto" position, we
compute the span based on its children. We mimick the formula used
by dotc to do so, but only upward (dotc also does some weird
mutating downward propagation, but AFAICT it will always store the
spans of leaf trees, so we don't need that).
@sjrd sjrd requested a review from adpi2 September 27, 2023 15:22
@adpi2
Copy link
Member

adpi2 commented Sep 28, 2023

Thanks I'll check that in the afternoon!

Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

It fixed many of the not-found symbols, including the last 2 classes!

@sjrd sjrd merged commit 4ae301f into scalacenter:main Sep 28, 2023
@sjrd sjrd deleted the auto-positions branch September 28, 2023 13:23
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.

2 participants