Skip to content

Commit

Permalink
Merge pull request #392 from sjrd/remove-useless-flags
Browse files Browse the repository at this point in the history
Remove useless flags.
  • Loading branch information
bishabosha authored Nov 18, 2023
2 parents 57e818f + a1e1041 commit a94afbd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,14 @@ final class Definitions private[tastyquery] (ctx: Context, rootPackage: PackageS
val inputTypeParams = List.tabulate(n) { i =>
ClassTypeParamSymbol
.create(typeName("T" + i), cls)
.withFlags(ClassTypeParam | Contravariant, None)
.withFlags(Contravariant, None)
.setDeclaredBounds(NothingAnyBounds)
.setAnnotations(Nil)
}
val resultTypeParam =
ClassTypeParamSymbol
.create(typeName("R"), cls)
.withFlags(ClassTypeParam | Covariant, None)
.withFlags(Covariant, None)
.setDeclaredBounds(NothingAnyBounds)
.setAnnotations(Nil)

Expand Down
8 changes: 1 addition & 7 deletions tasty-query/shared/src/main/scala/tastyquery/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,10 @@ private[tastyquery] object Flags:
val SignaturePolymorphic: Flag = newFlag("SignaturePolymorphic")
val SuperParamAlias: Flag = newFlag("SuperParamAlias")
val Static: Flag = newFlag("Static")
private[tastyquery] val StableRealizable: Flag = newFlag("StableRealizable")
val StableRealizable: Flag = newFlag("StableRealizable")
val Synthetic: Flag = newFlag("Synthetic")
val Trait: Flag = newFlag("Trait")
val Transparent: Flag = newFlag("Transparent")
val TypeParameter: Flag = newFlag("TypeParameter")

val VarianceFlags: FlagSet = Covariant | Contravariant

/** A symbol is a class' type parameter iff it has all of these flags. */
val ClassTypeParam: FlagSet = Private | TypeParameter

/** Modules always have these flags set */
val ModuleValCreationFlags: FlagSet = Module | Lazy | Final | StableRealizable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private[classfiles] object JavaSignatures:
val tparams = tparamNames.map { tname =>
val paramSym = ClassTypeParamSymbol.create(tname, cls)
allRegisteredSymbols += paramSym
paramSym.withFlags(ClassTypeParam | JavaDefined, None).setAnnotations(Nil)
paramSym.withFlags(JavaDefined, None).setAnnotations(Nil)
paramSym
}
val lookup = tparamNames.lazyZip(tparams).toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ private[tasties] class TreeUnpickler private (
flags |= ParamAccessor
if !rhsIsEmpty then // param alias
flags |= Method
if tag == TYPEPARAM then flags |= TypeParameter
flags

private def posErrorMsg: String = s"at address ${reader.currentAddr} in file $filename"
Expand Down

0 comments on commit a94afbd

Please sign in to comment.