diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/FlagSet.scala b/compiler/src/dotty/tools/dotc/tastyreflect/FlagSet.scala deleted file mode 100644 index 5aabdfc97b30..000000000000 --- a/compiler/src/dotty/tools/dotc/tastyreflect/FlagSet.scala +++ /dev/null @@ -1,70 +0,0 @@ -package dotty.tools.dotc.tastyreflect - -import dotty.tools.dotc.core.Flags -import dotty.tools.dotc.core.Flags._ - -class FlagSet(flags: Flags.FlagSet) extends scala.tasty.reflect.FlagSet { - - def isProtected: Boolean = flags.is(Protected) - def isAbstract: Boolean = flags.is(Abstract) - def isFinal: Boolean = flags.is(Final) - def isSealed: Boolean = flags.is(Sealed) - def isCase: Boolean = flags.is(Case) - def isImplicit: Boolean = flags.is(Implicit) - def isErased: Boolean = flags.is(Erased) - def isLazy: Boolean = flags.is(Lazy) - def isOverride: Boolean = flags.is(Override) - def isInline: Boolean = flags.is(Inline) - def isMacro: Boolean = flags.is(Macro) - def isStatic: Boolean = flags.is(JavaStatic) - def isObject: Boolean = flags.is(Module) - def isTrait: Boolean = flags.is(Trait) - def isLocal: Boolean = flags.is(Local) - def isSynthetic: Boolean = flags.is(Synthetic) - def isArtifact: Boolean = flags.is(Artifact) - def isMutable: Boolean = flags.is(Mutable) - def isFieldAccessor: Boolean = flags.is(Accessor) - def isCaseAcessor: Boolean = flags.is(CaseAccessor) - def isCovariant: Boolean = flags.is(Covariant) - def isContravariant: Boolean = flags.is(Contravariant) - def isScala2X: Boolean = flags.is(Scala2x) - def isDefaultParameterized: Boolean = flags.is(DefaultParameterized) - def isStable: Boolean = flags.is(Stable) - def isParam: Boolean = flags.is(Param) - def isParamAccessor: Boolean = flags.is(ParamAccessor) - def isPackage: Boolean = flags.is(Package) - - override def toString: String = { - val flags = List.newBuilder[String] - if (isProtected) flags += "protected " - if (isAbstract) flags += "abstract" - if (isFinal) flags += "final" - if (isSealed) flags += "sealed" - if (isCase) flags += "case" - if (isImplicit) flags += "implicit" - if (isErased) flags += "erased" - if (isLazy) flags += "lazy" - if (isOverride) flags += "override" - if (isInline) flags += "inline" - if (isMacro) flags += "macro" - if (isStatic) flags += "javaStatic" - if (isObject) flags += "object" - if (isTrait) flags += "trait" - if (isLocal) flags += "local" - if (isSynthetic) flags += "synthetic" - if (isArtifact) flags += "artifact" - if (isMutable) flags += "mutable" - if (isFieldAccessor) flags += "accessor" - if (isCaseAcessor) flags += "caseAccessor" - if (isCovariant) flags += "covariant" - if (isContravariant) flags += "contravariant" - if (isScala2X) flags += "scala2x" - if (isDefaultParameterized) flags += "defaultParameterized" - if (isStable) flags += "stable" - if (isParam) flags += "param" - if (isParamAccessor) flags += "paramAccessor" - if (isPackage) flags += "package" - flags.result().mkString("<", ",", ">") - } - -} diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/FlagsOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/FlagsOpsImpl.scala index a65357d20b32..d71935e79a50 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/FlagsOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/FlagsOpsImpl.scala @@ -40,7 +40,7 @@ trait FlagsOpsImpl extends scala.tasty.reflect.FlagsOps with CoreImpl { def Contravariant: Flags = core.Flags.Contravariant def Scala2X: Flags = core.Flags.Scala2x def DefaultParameterized: Flags = core.Flags.DefaultParameterized - def Stable: Flags = core.Flags.StableRealizable + def StableRealizable: Flags = core.Flags.StableRealizable def Param: Flags = core.Flags.Param def ParamAccessor: Flags = core.Flags.ParamAccessor } diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/SymbolOpsImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/SymbolOpsImpl.scala index c4359beacb1e..824f003663c1 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/SymbolOpsImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/SymbolOpsImpl.scala @@ -193,6 +193,11 @@ trait SymbolOpsImpl extends scala.tasty.reflect.SymbolOps with CoreImpl { val sym = symbol.moduleClass if (sym.exists) Some(sym.asClass) else None } + + def companionClass(implicit ctx: Context): Option[ClassSymbol] = { + val sym = symbol.companionClass + if (sym.exists) Some(sym.asClass) else None + } } object IsBindSymbol extends IsBindSymbolModule { diff --git a/library/src/scala/tasty/reflect/FlagsOps.scala b/library/src/scala/tasty/reflect/FlagsOps.scala index d75c72cf2db7..eafef4cf3d01 100644 --- a/library/src/scala/tasty/reflect/FlagsOps.scala +++ b/library/src/scala/tasty/reflect/FlagsOps.scala @@ -93,8 +93,8 @@ trait FlagsOps extends Core { /** Is this symbol a method with default parameters */ def DefaultParameterized: Flags - /** Is this symbol member that is assumed to be stable */ - def Stable: Flags + /** Is this symbol member that is assumed to be stable and realizable */ + def StableRealizable: Flags /** Is this symbol a parameter */ def Param: Flags diff --git a/library/src/scala/tasty/reflect/Printers.scala b/library/src/scala/tasty/reflect/Printers.scala index 6486334ef52a..cc5b827d7f01 100644 --- a/library/src/scala/tasty/reflect/Printers.scala +++ b/library/src/scala/tasty/reflect/Printers.scala @@ -126,7 +126,7 @@ trait Printers if (flags.is(Flags.Contravariant)) flagList += "Flags.Contravariant" if (flags.is(Flags.Scala2X)) flagList += "Flags.Scala2X" if (flags.is(Flags.DefaultParameterized)) flagList += "Flags.DefaultParameterized" - if (flags.is(Flags.Stable)) flagList += "Flags.Stable" + if (flags.is(Flags.StableRealizable)) flagList += "Flags.StableRealizable" if (flags.is(Flags.Param)) flagList += "Flags.Param" if (flags.is(Flags.ParamAccessor)) flagList += "Flags.ParamAccessor" flagList.result().mkString(" | ") @@ -501,7 +501,7 @@ trait Printers if (flags.is(Flags.Contravariant)) flagList += "contravariant" if (flags.is(Flags.Scala2X)) flagList += "scala2x" if (flags.is(Flags.DefaultParameterized)) flagList += "defaultParameterized" - if (flags.is(Flags.Stable)) flagList += "stable" + if (flags.is(Flags.StableRealizable)) flagList += "stableRealizable" if (flags.is(Flags.Param)) flagList += "param" if (flags.is(Flags.ParamAccessor)) flagList += "paramAccessor" flagList.result().mkString("/*", " ", "*/") diff --git a/library/src/scala/tasty/reflect/SymbolOps.scala b/library/src/scala/tasty/reflect/SymbolOps.scala index b16307278b3e..cd69466efdf7 100644 --- a/library/src/scala/tasty/reflect/SymbolOps.scala +++ b/library/src/scala/tasty/reflect/SymbolOps.scala @@ -155,6 +155,8 @@ trait SymbolOps extends Core { /** The class symbol of the companion module class */ def moduleClass(implicit ctx: Context): Option[ClassSymbol] + + def companionClass(implicit ctx: Context): Option[ClassSymbol] } implicit def ValSymbolDeco(symbol: ValSymbol): ValSymbolAPI