-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor TASTy Attributes #19091
Conversation
val scala2StandardLibrary: Boolean, | ||
val explicitNulls: Boolean, | ||
) | ||
val booleanTags: List[Int], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.
while !isAtEnd do | ||
booleanTags += readByte() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.