Skip to content

Use BitSet for boolean TASTy attributes #19092

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

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Hide TASTy tags encoding from outside tasty package
  • Loading branch information
nicolasstucki committed Nov 27, 2023
commit fafa45ba9fc921f227ac77873c629111ecaeac30
16 changes: 7 additions & 9 deletions compiler/src/dotty/tools/dotc/core/tasty/Attributes.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package dotty.tools.dotc.core.tasty

import dotty.tools.tasty.TastyFormat
import dotty.tools.tasty.TastyFormat.*

import scala.collection.immutable.BitSet

class Attributes(
val booleanTags: BitSet,
class Attributes private[tasty](
private[tasty] val booleanTags: BitSet,
) {
def scala2StandardLibrary: Boolean =
booleanTags.contains(TastyFormat.SCALA2STANDARDLIBRARYattr)
def explicitNulls: Boolean =
booleanTags.contains(TastyFormat.EXPLICITNULLSattr)
def scala2StandardLibrary: Boolean = booleanTags(SCALA2STANDARDLIBRARYattr)
def explicitNulls: Boolean = booleanTags(EXPLICITNULLSattr)
}

object Attributes:
Expand All @@ -19,8 +17,8 @@ object Attributes:
explicitNulls: Boolean,
): Attributes =
val booleanTags = BitSet.newBuilder
if scala2StandardLibrary then booleanTags += TastyFormat.SCALA2STANDARDLIBRARYattr
if explicitNulls then booleanTags += TastyFormat.EXPLICITNULLSattr
if scala2StandardLibrary then booleanTags += SCALA2STANDARDLIBRARYattr
if explicitNulls then booleanTags += EXPLICITNULLSattr
new Attributes(booleanTags.result())
end apply

Expand Down