Symbols

dotty.tools.dotc.core.Symbols
object Symbols extends SymUtils

Attributes

Graph
Supertypes
class SymUtils
class Object
trait Matchable
class Any
Self type
Symbols.type

Members list

Type members

Classlikes

class ClassSymbol extends Symbol

Attributes

Supertypes
class Symbol
trait Showable
trait SrcPos
trait ParamInfo
class Designator
class Object
trait Matchable
class Any
Show all
object NoSymbol extends Symbol

Attributes

Supertypes
class Symbol
trait Showable
trait SrcPos
trait ParamInfo
class Designator
class Object
trait Matchable
class Any
Show all
Self type
NoSymbol.type

A Symbol represents a Scala definition/declaration or a package.

A Symbol represents a Scala definition/declaration or a package.

Value parameters

id

A unique identifier of the symbol (unique per ContextBase)

myCoord

The coordinates of the symbol (a position or an index)

Attributes

Supertypes
trait Showable
trait SrcPos
trait ParamInfo
class Designator
class Object
trait Matchable
class Any
Show all
Known subtypes
class ClassSymbol
object NoSymbol
object TermSymbols

Matches lists of term symbols, including the empty list. All symbols in the list are assumed to be of the same kind.

Matches lists of term symbols, including the empty list. All symbols in the list are assumed to be of the same kind.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object TypeSymbols

Matches lists of type symbols, excluding the empty list. All symbols in the list are assumed to be of the same kind.

Matches lists of type symbols, excluding the empty list. All symbols in the list are assumed to be of the same kind.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Types

type TermSymbol = Symbol { type ThisName = TermName; }
type TypeSymbol = Symbol { type ThisName = TypeName; }

Value members

Concrete methods

def MutableSymbolMap[T](initialCapacity: Int): EqHashMap[Symbol, T]

The current class

The current class

Attributes

def defn(using Context): Definitions

The Definitions object

The Definitions object

Attributes

Get ClassSymbol if class is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Get ClassSymbol if class is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Attributes

Get a List of ClassSymbols which are either defined in current compilation run or present on classpath.

Get a List of ClassSymbols which are either defined in current compilation run or present on classpath.

Attributes

Get module symbol if the module is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Get module symbol if the module is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Attributes

Get ClassSymbol if package is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Get ClassSymbol if package is either defined in current compilation run or present on classpath. Returns NoSymbol otherwise.

Attributes

def mapSymbols(originals: List[Symbol], ttmap: TreeTypeMap, mapAlways: Boolean)(using Context): List[Symbol]

Map given symbols, subjecting their attributes to the mappings defined in the given TreeTypeMap ttmap. Cross symbol references are brought over from originals to copies. Do not copy any symbols if all attributes of all symbols stay the same.

Map given symbols, subjecting their attributes to the mappings defined in the given TreeTypeMap ttmap. Cross symbol references are brought over from originals to copies. Do not copy any symbols if all attributes of all symbols stay the same.

Attributes

def newAnonFun(owner: Symbol, info: Type, coord: Coord)(using Context): TermSymbol

Create an anonymous function symbol

Create an anonymous function symbol

Attributes

def newClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, infoFn: ClassSymbol => Type, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): ClassSymbol

Create a class symbol from its non-info fields and a function producing its info (the produced info may be lazy).

Create a class symbol from its non-info fields and a function producing its info (the produced info may be lazy).

Attributes

def newCompleteClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, parents: List[TypeRef], decls: Scope, selfInfo: Type, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): ClassSymbol

Create a class symbol from its non-info fields and the fields of its info.

Create a class symbol from its non-info fields and the fields of its info.

Attributes

def newCompleteModuleSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, parents: List[TypeRef], decls: Scope, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): TermSymbol

Create a module symbol with associated module class from its non-info fields and the fields of the module class info.

Create a module symbol with associated module class from its non-info fields and the fields of the module class info.

Value parameters

flags

The combined flags of the module and the module class These are masked with RetainedModuleValFlags/RetainedModuleClassFlags.

Attributes

def newCompletePackageSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, decls: Scope)(using Context): TermSymbol

Create a package symbol with associated package class from its non-info fields its member scope.

Create a package symbol with associated package class from its non-info fields its member scope.

Attributes

def newConstructor(cls: ClassSymbol, flags: FlagSet, paramNames: List[TermName], paramTypes: List[Type], privateWithin: Symbol, coord: Coord)(using Context): TermSymbol

Create a class constructor symbol for given class cls.

Create a class constructor symbol for given class cls.

Attributes

Create an empty default constructor symbol for given class cls.

Create an empty default constructor symbol for given class cls.

Attributes

def newErrorSymbol(owner: Symbol, name: Name, msg: Message)(using Context): Symbol
def newImportSymbol(owner: Symbol, expr: Tree, coord: Coord)(using Context): TermSymbol

Create an import symbol pointing back to given qualifier expr.

Create an import symbol pointing back to given qualifier expr.

Attributes

def newImportSymbol(owner: Symbol, info: Type, coord: Coord)(using Context): TermSymbol

Create an import symbol with given info.

Create an import symbol with given info.

Attributes

def newLazyImplicit(info: Type, coord: Coord)(using Context): TermSymbol
def newLocalDummy(cls: Symbol, coord: Coord)(using Context): TermSymbol

Create the local template dummy of given class cls. In a template

Create the local template dummy of given class cls. In a template

trait T { val fld: Int; { val x: int = 2 }; val fld2 = { val y = 2; y }}

the owner of x is the local dummy of the template. The owner of the local dummy is then the class of the template itself. By contrast, the owner of y would be fld2. There is a single local dummy per template.

Attributes

def newModuleSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, infoFn: (TermSymbol, ClassSymbol) => Type, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): TermSymbol

Create a module symbol with associated module class from its non-info fields and a function producing the info of the module class (this info may be lazy).

Create a module symbol with associated module class from its non-info fields and a function producing the info of the module class (this info may be lazy).

Attributes

def newNormalizedClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, parentTypes: List[Type], selfInfo: Type, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): ClassSymbol

Same as newCompleteClassSymbol except that parents can be a list of arbitrary types which get normalized into type refs and parameter bindings.

Same as newCompleteClassSymbol except that parents can be a list of arbitrary types which get normalized into type refs and parameter bindings.

Attributes

def newNormalizedModuleSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, parentTypes: List[Type], decls: Scope, privateWithin: Symbol, coord: Coord, compUnitInfo: CompilationUnitInfo | Null)(using Context): TermSymbol

Same as newCompleteModuleSymbol except that parents can be a list of arbitrary types which get normalized into type refs and parameter bindings.

Same as newCompleteModuleSymbol except that parents can be a list of arbitrary types which get normalized into type refs and parameter bindings.

Attributes

def newPackageSymbol(owner: Symbol, name: TermName, infoFn: (TermSymbol, ClassSymbol) => LazyType)(using Context): TermSymbol

Create a package symbol with associated package class from its non-info fields and a lazy type for loading the package's members.

Create a package symbol with associated package class from its non-info fields and a lazy type for loading the package's members.

Attributes

def newPatternBoundSymbol(name: Name, info: Type, span: Span, addToGadt: Boolean, flags: FlagSet)(using Context): Symbol

Define a new symbol associated with a Bind or pattern wildcard and, by default, make it gadt narrowable.

Define a new symbol associated with a Bind or pattern wildcard and, by default, make it gadt narrowable.

Attributes

def newSelfSym(cls: ClassSymbol, name: TermName, selfInfo: Type)(using Context): TermSymbol

Create a symbol representing a selftype declaration for class cls.

Create a symbol representing a selftype declaration for class cls.

Attributes

def newSkolem(tp: Type)(using Context): TermSymbol

Create a new skolem symbol. This is not the same as SkolemType, even though the motivation (create a singleton referencing to a type) is similar.

Create a new skolem symbol. This is not the same as SkolemType, even though the motivation (create a singleton referencing to a type) is similar.

Attributes

def newStubSymbol(owner: Symbol, name: Name, compUnitInfo: CompilationUnitInfo | Null)(using Context): Symbol

Create a stub symbol that will issue a missing reference error when attempted to be completed.

Create a stub symbol that will issue a missing reference error when attempted to be completed.

Attributes

def newSymbol[N <: Name](using Context)(owner: Symbol, name: N, flags: FlagSet, info: Type, privateWithin: Symbol, coord: Coord, nestingLevel: Int): Symbol { type ThisName = N; }

Create a symbol from its fields (info may be lazy)

Create a symbol from its fields (info may be lazy)

Attributes

def newTypeParams(owner: Symbol, names: List[TypeName], flags: FlagSet, boundsFn: (List[TypeRef]) => List[Type])(using Context): List[TypeSymbol]

Create new type parameters with given owner, names, and flags.

Create new type parameters with given owner, names, and flags.

Value parameters

boundsFn

A function that, given type refs to the newly created parameters returns a list of their bounds.

Attributes

Concrete fields

val Ids: Key[Array[String]]

Tree attachment containing the identifiers in a tree as a sorted array

Tree attachment containing the identifiers in a tree as a sorted array

Attributes

Extensions

Inherited extensions

extension (self: Symbol)
def accessorNamed(name: TermName)(using Context): Symbol

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

The ConstantType of a val known to be isConstrExprFinalVal.

The ConstantType of a val known to be isConstrExprFinalVal.

Attributes

Inherited from:
SymUtils

The declared self type of this class, as seen from site, stripping all refinements for opaque types.

The declared self type of this class, as seen from site, stripping all refinements for opaque types.

Attributes

Inherited from:
SymUtils
def deriveTargetNameAnnotation(original: Symbol, nameFn: Name => Name)(using Context): Unit

If original has a target name annotation, add one to this symbol as well such that the new target name is original's target name transformed by nameFn.

If original has a target name annotation, add one to this symbol as well such that the new target name is original's target name transformed by nameFn.

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

All traits implemented by a class or trait except for those inherited through the superclass. Traits are given in the order they appear in the parents clause (which is the reverse of their order in baseClasses)

All traits implemented by a class or trait except for those inherited through the superclass. Traits are given in the order they appear in the parents clause (which is the reverse of their order in baseClasses)

Attributes

Inherited from:
SymUtils

The closest enclosing method or class of this symbol

The closest enclosing method or class of this symbol

Attributes

Inherited from:
SymUtils
final def enclosure(using Context): Symbol

The closest properly enclosing method or class of this symbol.

The closest properly enclosing method or class of this symbol.

Attributes

Inherited from:
SymUtils
def field(using Context): Symbol

Attributes

Inherited from:
SymUtils
def getter(using Context): Symbol

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Is this symbol a constant expression final val?

Is this symbol a constant expression final val?

This is the case if all of the following are true:

  • it is a final val,
  • its result type is a ConstantType, and
  • it does not need an explicit field because of Scala.js semantics (see JSSymUtils.sjsNeedsField).

Constant expression final vals do not need an explicit field to store their value. See the Memoize-Mixin-Constructors phase trio.

Attributes

Inherited from:
SymUtils

Is symbol assumed or declared as an infix symbol?

Is symbol assumed or declared as an infix symbol?

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils
def isEnum(using Context): Boolean

Attributes

Inherited from:
SymUtils

Does this symbol refer to anonymous classes synthesized by enum desugaring?

Does this symbol refer to anonymous classes synthesized by enum desugaring?

Attributes

Inherited from:
SymUtils
def isEnumCase(using Context): Boolean

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Is symbol declared or inherits @experimental?

Is symbol declared or inherits @experimental?

Attributes

Inherited from:
SymUtils
def isField(using Context): Boolean

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils
def isGenericSum(pre: Type)(using Context): Boolean

Attributes

Inherited from:
SymUtils

Is this the method that summons a structural given instance?

Is this the method that summons a structural given instance?

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Is this symbol defined locally (i.e. at some level owned by a term) so that it cannot be seen from parent class cls?

Is this symbol defined locally (i.e. at some level owned by a term) so that it cannot be seen from parent class cls?

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils
final def isLocal(using Context): Boolean

Is symbol directly or indirectly owned by a term symbol?

Is symbol directly or indirectly owned by a term symbol?

Attributes

Inherited from:
SymUtils

Is this symbol directly owner by a term symbol, i.e., is it local to a block?

Is this symbol directly owner by a term symbol, i.e., is it local to a block?

Attributes

Inherited from:
SymUtils
def isNoValue(using Context): Boolean

Attributes

Inherited from:
SymUtils
def isOldStyleImplicitConversion(directOnly: Boolean, forImplicitClassOnly: Boolean)(using Context): Boolean

Is this an old style implicit conversion?

Is this an old style implicit conversion?

Value parameters

directOnly

only consider explicitly written methods

forImplicitClassOnly

only consider methods generated from implicit classes

Attributes

Inherited from:
SymUtils

Is this a type or term parameter or a term parameter accessor?

Is this a type or term parameter or a term parameter accessor?

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils
def isTypeCast(using Context): Boolean

Attributes

Inherited from:
SymUtils

Is symbol a type splice operation?

Is symbol a type splice operation?

Attributes

Inherited from:
SymUtils
def isTypeTest(using Context): Boolean

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils
def isVolatile(using Context): Boolean

Attributes

Inherited from:
SymUtils

The return type as seen from the body of this definition. It is computed from the symbol's type by replacing param refs by param symbols.

The return type as seen from the body of this definition. It is computed from the symbol's type by replacing param refs by param symbols.

Attributes

Inherited from:
SymUtils

All traits implemented by a class, except for those inherited through the superclass. The empty list if self is a trait.

All traits implemented by a class, except for those inherited through the superclass. The empty list if self is a trait.

Attributes

Inherited from:
SymUtils
def returnProto(using Context): Type

The expected type of a return to self at the place indicated by the context. This is the local return type instantiated by the symbols of any context function closures that enclose the site of the return

The expected type of a return to self at the place indicated by the context. This is the local return type instantiated by the symbols of any context function closures that enclose the site of the return

Attributes

Inherited from:
SymUtils
def setter(using Context): Symbol

Attributes

Inherited from:
SymUtils
final def skipConstructor(using Context): Symbol

If this is a constructor, its owner: otherwise this.

If this is a constructor, its owner: otherwise this.

Attributes

Inherited from:
SymUtils
def subst(from: List[Symbol], to: List[Symbol]): Symbol

Apply symbol/symbol substitution to this symbol

Apply symbol/symbol substitution to this symbol

Attributes

Inherited from:
SymUtils
def traitSetter(using Context): Symbol

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Attributes

Inherited from:
SymUtils

Is this a case class for which a product mirror is generated? Excluded are value classes, abstract classes and case classes with more than one parameter section.

Is this a case class for which a product mirror is generated? Excluded are value classes, abstract classes and case classes with more than one parameter section.

Attributes

Inherited from:
SymUtils
def whyNotGenericSum(pre: Type)(using Context): String

Is this a sealed class or trait for which a sum mirror is generated? It must satisfy the following conditions:

Is this a sealed class or trait for which a sum mirror is generated? It must satisfy the following conditions:

  • it has at least one child class or object
  • none of its children are anonymous classes
  • all of its children are addressable through a path from the parent class and also the location of the generated mirror.
  • all of its children are generic products, singletons, or generic sums themselves.

Attributes

Inherited from:
SymUtils
def withAnnotationsCarrying(from: Symbol, meta: Symbol, orNoneOf: Set[Symbol])(using Context): self.type

Attributes

Inherited from:
SymUtils

Implicits

Implicits

implicit def eqSymbol: CanEqual[Symbol, Symbol]
implicit def toClassDenot(cls: ClassSymbol)(using Context): ClassDenotation

Makes all class denotation operations available on class symbols

Makes all class denotation operations available on class symbols

Attributes

implicit def toDenot(sym: Symbol)(using Context): SymDenotation

Makes all denotation operations available on symbols

Makes all denotation operations available on symbols

Attributes