Symbols

tastyquery.Symbols
object Symbols

Symbols for all kinds of definitions in Scala programs.

Every definition, like classes, defs, types and type parameters, is associated with a Symbol. Symbols are organized in a hierarchy, depending on what kind of definitions they represent.

Symbol
|
+- PackageSymbol                   any package, including the root package, the empty package, and nested packages
|
+- TermOrTypeSymbol                   any term or type symbol, i.e., not a package
   |
   +- TermSymbol                      any term definition:
   |                                  `val`, `var`, `def`, term param, term capture, `object` value
   |
   +- TypeSymbol                      any definition for a type
      +- ClassSymbol                  definition for a `class`, `trait`, or the module class of an `object`
      +- TypeSymbolWithBounds         any other kind of type: `type` definitions, type params, type captures
         +- TypeMemberSymbol          `type` definition, further refined through its `typeDef`
         +- TypeParamSymbol
            +- ClassTypeParamSymbol   type parameter of a class
            +- LocalTypeParamSymbol   any other type parameter

Additionally, PackageSymbol and ClassSymbol extend DeclaringSymbol. Declaring symbols are the ones that contain declarations, which can be looked up with their names.

TypeMemberSymbols exist in 3 flavors, indicated by their typeDef field, of type TypeMemberDefinition:

  • TypeAlias(alias): type alias of the form type T = alias
  • AbstractType(bounds): abstract type member of the form type T >: bounds.low <: bounds.high
  • OpaqueTypeAlias(bounds, alias): opaque type alias of the form type T >: bounds.low <: bounds.high = alias

The main property a TermSymbol is its declaredType, which is a Type. All TypeSymbolWithBounds have bounds of type TypeBounds, which are often used as their primary characteristic. ClassSymbols are entirely defined by themselves.

With the exception of the root package symbol, all symbols have an owner which is another Symbol.

All symbols also have a name. It is a TypeName for TypeSymbols, and a TermName for TermSymbols and PackageSymbols.

Attributes

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

Members list

Type members

Classlikes

final class ClassSymbol extends TypeSymbol, DeclaringSymbol

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all
sealed trait DeclaringSymbol extends Symbol

Attributes

Supertypes
class Symbol
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all
final class PackageSymbol extends Symbol, DeclaringSymbol

Attributes

Supertypes
class Symbol
class Object
trait Matchable
class Any
sealed abstract class Symbol(val owner: Symbol | Null)

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
sealed abstract class TermOrTypeSymbol(val owner: Symbol) extends Symbol

Attributes

Supertypes
class Symbol
class Object
trait Matchable
class Any
Known subtypes
final class TermSymbol extends TermOrTypeSymbol

Attributes

Supertypes
class Symbol
class Object
trait Matchable
class Any

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all
sealed abstract class TypeParamSymbol(name: TypeName, owner: Symbol) extends TypeSymbolWithBounds

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all
Known subtypes
sealed abstract class TypeSymbol(val name: TypeName, owner: Symbol) extends TermOrTypeSymbol

Attributes

Supertypes
class Symbol
class Object
trait Matchable
class Any
Known subtypes
sealed abstract class TypeSymbolWithBounds(name: TypeName, owner: Symbol) extends TypeSymbol

Attributes

Supertypes
class TypeSymbol
class Symbol
class Object
trait Matchable
class Any
Show all
Known subtypes

Types

type ParamSymbolsClause = Either[List[TermSymbol], List[LocalTypeParamSymbol]]