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

add child to parent in completion context #21214

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

bishabosha
Copy link
Member

This ensures that the positions of forced Child annotations always happens in the source file of the parent class, and not in another file that forced the completion to happen

fixes #21154

1884: 293 .. 293

source paths:
0: 27 [<elided source file name>]
Copy link
Member Author

Choose a reason for hiding this comment

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

the magic is that if you revert the change to Namer, then this will have three source paths - because the positions of the child annotations will be set in the context of A.scala - i.e. the call site that forces the completion

This ensures that the positions of forced Child annotations
always happens in the source file of the parent class, and not in
another file that forced the completion to happen
@bishabosha bishabosha force-pushed the fix-child-creation-ctx branch from 06bd788 to a2bec5e Compare July 17, 2024 20:56
Copy link
Contributor

@raboof raboof left a comment

Choose a reason for hiding this comment

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

I tested this PR with my reproducer at https://codeberg.org/raboof/scala3-reproduce-21154 (invoking scalac directly, no sbt), and it appears to have the intended effect: no more references to FcmJsonSupport.scala in FcmOption.tasty, and also the previously-nondeterministic 'positions' entries are gone.

@bishabosha bishabosha requested a review from sjrd July 24, 2024 08:06
@bishabosha bishabosha assigned sjrd and unassigned Gedochao Jul 24, 2024
@bishabosha bishabosha removed the request for review from Gedochao July 24, 2024 08:06
@sjrd sjrd merged commit 0cf25db into scala:main Jul 24, 2024
25 checks passed
@sjrd sjrd deleted the fix-child-creation-ctx branch July 24, 2024 08:12
hamzaremmal added a commit that referenced this pull request Jul 25, 2024
unfortunately it seems changing the classpath means representation of
TASTy is not stable (but is semantically equivalent) i.e. some
SHAREDtype might be replaced by equivalent types. This breaks the
tastycheck test in #21214 with scala
2 library tasty.

By changing to ordinary classes instead of enum cases, we limit
generated code and avoid these specific examples of instability in the
test.

Manually, I confirmed that reverting the change to namer in #21214 still
breaks the new test

[test_scala2_library_tasty]
WojciechMazur added a commit that referenced this pull request Aug 27, 2024
Backports #21214 to the 3.5.2 branch.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added this to the 3.5.2 milestone Oct 8, 2024
WojciechMazur added a commit that referenced this pull request Dec 3, 2024
Backports #21214 to the 3.3.5.

PR submitted by the release tooling.
[skip ci]
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.

reproducible builds: undeterministic additional source path references in tasty
5 participants