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

Refactor TASTy Attributes #19091

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 27, 2023

We generalize the internal encoding of Attributes to be a list of tags. Then we add add helper methods to have simpler ways to interact with this abstraction using booleans. This implies that the pickling/unpickling can be agnostic of the semantics of each tag. Therefore reducing the number of places that need to be updated when we add a new tag.

Useful for #19074, #19033, and #18948.

val scala2StandardLibrary: Boolean,
val explicitNulls: Boolean,
)
val booleanTags: List[Int],
Copy link
Member

Choose a reason for hiding this comment

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

couldn't this be a bitset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could. I will try to optimize this in a separate PR. Will merge as is to unblock the other PRs.

@nicolasstucki nicolasstucki merged commit e7f8a2c into scala:main Nov 27, 2023
19 checks passed
@nicolasstucki nicolasstucki deleted the refactor-tasty-attributes branch November 27, 2023 11:58
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Nov 27, 2023
We generalize the internal encoding of `Attributes` to be a list of
tags. Then we add add helper methods to have simpler ways to interact
with this abstraction using booleans. This implies that the
pickling/unpickling can be agnostic of the semantics of each tag.
Therefore reducing the number of places that need to be updated when we
add a new tag.

Useful for scala#19074, scala#19033, and scala#18948.
Comment on lines +14 to +15
while !isAtEnd do
booleanTags += readByte()
Copy link
Member

Choose a reason for hiding this comment

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

Hum, ouch. We shouldn't do that. we should actively refuse to read any unknown tag. Tags may be non-boolean in the future (e.g., source file). This implementation would too easily "fail to fail" on incompatible extensions.

Copy link
Contributor Author

@nicolasstucki nicolasstucki Nov 27, 2023

Choose a reason for hiding this comment

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

I will add non-boolean tags in #18948. Those concerns are addressed there already.

@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
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.

None yet

4 participants