Symbols

object Symbols
class Object
trait Matchable
class Any

Type members

Classlikes

class ClassSymbol extends Symbol
object NoSymbol extends Symbol
class Symbol extends Designator with ParamInfo with SrcPos with Showable

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

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

Value Params
coord

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

id

A unique identifier of the symbol (unique per ContextBase)

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.

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.

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

def defn(using Context): Definitions

The Definitions object

The Definitions object

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.

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.

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.

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.

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.

def newClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, infoFn: ClassSymbol => Type, privateWithin: Symbol, coord: Coord, assocFile: AbstractFile)(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).

Create a class symbol from a function producing its denotation

Create a class symbol from a function producing its denotation

def newCompleteClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, parents: List[TypeRef], decls: Scope, selfInfo: Type, privateWithin: Symbol, coord: Coord, assocFile: AbstractFile)(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.

def newCompleteModuleSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, parents: List[TypeRef], decls: Scope, privateWithin: Symbol, coord: Coord, assocFile: AbstractFile)(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 Params
flags

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

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.

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.

Create an empty default constructor symbol for given class cls.

Create an empty default constructor symbol for given class cls.

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.

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.

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.

def newModuleSymbol(owner: Symbol, name: TermName, modFlags: FlagSet, clsFlags: FlagSet, infoFn: (TermSymbol, ClassSymbol) => Type, privateWithin: Symbol, coord: Coord, assocFile: AbstractFile)(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).

def newNakedClassSymbol(coord: Coord, assocFile: AbstractFile)(using Context): ClassSymbol

Create a class symbol without a denotation.

Create a class symbol without a denotation.

def newNakedSymbol[N <: Name](coord: Coord)(using Context): Symbol { type ThisName = N; }

Create a symbol without a denotation. Note this uses a cast instead of a direct type refinement because it's debug-friendlier not to create an anonymous class here.

Create a symbol without a denotation. Note this uses a cast instead of a direct type refinement because it's debug-friendlier not to create an anonymous class here.

def newNormalizedClassSymbol(owner: Symbol, name: TypeName, flags: FlagSet, parentTypes: List[Type], decls: Scope, selfInfo: Type, privateWithin: Symbol, coord: Coord, assocFile: AbstractFile)(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.

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.

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.

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.

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.

def newStubSymbol(owner: Symbol, name: Name, file: AbstractFile)(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.

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

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

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

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 Params
boundsFn

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

Concrete fields

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

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

Extensions

Extensions

extension (sym: Symbol { type ThisName = N; })
def copy[N <: Name](using Context)(owner: Symbol, name: N, flags: FlagSet, info: Type, privateWithin: Symbol, coord: Coord, associatedFile: AbstractFile): Symbol

Copy a symbol, overriding selective fields. Note that coord and associatedFile will be set from the fields in owner, not the fields in sym.

Copy a symbol, overriding selective fields. Note that coord and associatedFile will be set from the fields in owner, not the fields in sym.

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

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

Makes all denotation operations available on symbols

Makes all denotation operations available on symbols