LocalChecker

dotty.tools.dotc.transform.TreeChecker.LocalChecker
class LocalChecker(phasesToCheck: Seq[Phase]) extends Checker

Tree checker that can be applied to a local tree.

Attributes

Graph
Supertypes
class Checker
class ReTyper
trait ReChecking
class Typer
trait Migrations
trait Deriving
trait Checking
trait Dynamic
trait Inferencing
trait Implicits
trait Applications
trait TypeAssigner
class Namer
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited classlikes

class ApplicableToTrees(methRef: TermRef, args: List[Tree], resultType: Type, argMatch: ArgMatch)(using x$5: Context) extends TestApplication[Tree[Type]]

Subclass of Application for applicability tests with type arguments and value argument trees.

Subclass of Application for applicability tests with type arguments and value argument trees.

Attributes

Inherited from:
Applications
Supertypes
class Object
trait Matchable
class Any
class ApplicableToTypes(methRef: TermRef, args: List[Type], resultType: Type, argMatch: ArgMatch)(using x$5: Context) extends TestApplication[Type]

Subclass of Application for applicability tests with value argument types.

Subclass of Application for applicability tests with value argument types.

Attributes

Inherited from:
Applications
Supertypes
class Application[Type]
class Object
trait Matchable
class Any
class ApplyToTyped(app: Apply, fun: Tree, methRef: TermRef, args: List[Tree], resultType: Type, applyKind: ApplyKind)(using x$7: Context) extends TypedApply[Type]

Subclass of Application for type checking an Apply node with typed arguments.

Subclass of Application for type checking an Apply node with typed arguments.

Attributes

Inherited from:
Applications
Supertypes
class TypedApply[Type]
class Object
trait Matchable
class Any
class ApplyToUntyped(app: Apply, fun: Tree, methRef: TermRef, proto: FunProto, resultType: Type)(using x$6: Context) extends TypedApply[Type | Null]

Subclass of Application for type checking an Apply node with untyped arguments.

Subclass of Application for type checking an Apply node with untyped arguments.

Attributes

Inherited from:
Applications
Supertypes
class TypedApply[Type | Null]
class Application[Tree[Type | Null]]
class Object
trait Matchable
class Any
enum ArgMatch

The degree to which an argument has to match a formal parameter

The degree to which an argument has to match a formal parameter

Attributes

Inherited from:
Applications
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class ClassCompleter(cls: ClassSymbol, original: TypeDef)(ictx: Context) extends Completer

Attributes

Inherited from:
Namer
Supertypes
class Completer
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Show all
class Completer(val original: Tree)(ictx: Context) extends LazyType, SecondCompleter

The completer of a symbol defined by a member def or import (except ClassSymbols)

The completer of a symbol defined by a member def or import (except ClassSymbols)

Attributes

Inherited from:
Namer
Supertypes
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Deriver(cls: ClassSymbol, codePos: SrcPos)(using x$3: Context)

A helper class to derive type class instances for one class or object

A helper class to derive type class instances for one class or object

Value parameters

cls

The class symbol of the class or object with a derives clause

codePos

The default position that should be given to generic synthesized infrastructure code that is not connected with a derives instance.

Attributes

Inherited from:
Deriving
Supertypes
class Object
trait Matchable
class Any
class ImplicitSearch(val pt: Type, val argument: Tree, span: Span)(using x$4: Context)

An implicit search; parameters as in inferImplicit

An implicit search; parameters as in inferImplicit

Attributes

Inherited from:
Implicits
Supertypes
class Object
trait Matchable
class Any

Attributes

Inherited from:
Namer
Supertypes
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Show all
class TypeDefCompleter(original: TypeDef)(ictx: Context) extends Completer, TypeParamsCompleter

Attributes

Inherited from:
Namer
Supertypes
class Completer
class LazyType
trait Symbol => LazyType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Show all

Attributes

Inherited from:
Implicits
Supertypes
class Object
trait Matchable
class Any

Inherited and Abstract classlikes

abstract class Application[Arg](methRef: TermRef, funType: Type, args: List[Arg], resultType: Type)(using x$5: Context)

Type parameters

Arg

the type of arguments, could be tpd.Tree, untpd.Tree, or Type

Value parameters

args

the arguments of the application

funType

the type of the function part of the application

methRef

the reference to the method of the application

resultType

the expected result type of the application

Attributes

Inherited from:
Applications
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class TestApplication[Arg]
class TypedApply[T]
class ApplyToTyped
Show all
abstract class TestApplication[Arg](methRef: TermRef, funType: Type, args: List[Arg], resultType: Type, argMatch: ArgMatch)(using x$6: Context) extends Application[Arg]

Subclass of Application for the cases where we are interested only in a "can/cannot apply" answer, without needing to construct trees or issue error messages.

Subclass of Application for the cases where we are interested only in a "can/cannot apply" answer, without needing to construct trees or issue error messages.

Attributes

Inherited from:
Applications
Supertypes
class Application[Arg]
class Object
trait Matchable
class Any
Known subtypes
abstract class TypedApply[T <: Untyped](app: Apply, fun: Tree, methRef: TermRef, args: List[Tree[T]], resultType: Type, val applyKind: ApplyKind)(using x$7: Context) extends Application[Tree[T]]

Subclass of Application for type checking an Apply node, where types of arguments are either known or unknown.

Subclass of Application for type checking an Apply node, where types of arguments are either known or unknown.

Attributes

Inherited from:
Applications
Supertypes
class Application[Tree[T]]
class Object
trait Matchable
class Any
Known subtypes

Value members

Concrete methods

override def assertDefined(tree: Tree)(using Context): Unit

Attributes

Definition Classes

Inherited methods

def ApplyTo(app: Apply, fun: Tree, methRef: TermRef, proto: FunProto, resultType: Type)(using Context): Tree

Typecheck an Apply node with a typed function and possibly-typed arguments coming from proto

Typecheck an Apply node with a typed function and possibly-typed arguments coming from proto

Attributes

Inherited from:
Applications
def accessibleType(tpe: Type, superAccess: Boolean)(using Context): Type

If tpe is a named type, return the type with those alternatives as denotations which are accessible (or NoType, if no alternatives are accessible).

If tpe is a named type, return the type with those alternatives as denotations which are accessible (or NoType, if no alternatives are accessible).

Also performs the following normalizations on the type tpe. (1) if the owner of the denotation is a package object, it is assured that the package object shows up as the prefix. (2) in Java compilation units, Object is replaced by defn.FromJavaObjectType

Attributes

Inherited from:
TypeAssigner
override def adapt(tree: Tree, pt: Type, locked: TypeVars)(using Context): Tree

Perform the following adaptations of expression, pattern or type tree wrt to given prototype pt: (1) Resolve overloading (2) Apply parameterless functions (3) Apply polymorphic types to fresh instances of their type parameters and store these instances in context.undetparams, unless followed by explicit type application. (4) Do the following to unapplied methods used as values: (4.1) If the method has only implicit parameters pass implicit arguments (4.2) otherwise, if pt is a function type and method is not a constructor, convert to function by eta-expansion, (4.3) otherwise, if the method is nullary with a result type compatible to pt and it is not a constructor, apply it to () otherwise issue an error (5) Convert constructors in a pattern as follows: (5.1) If constructor refers to a case class factory, set tree's type to the unique instance of its primary constructor that is a subtype of the expected type. (5.2) If constructor refers to an extractor, convert to application of unapply or unapplySeq method.

Perform the following adaptations of expression, pattern or type tree wrt to given prototype pt: (1) Resolve overloading (2) Apply parameterless functions (3) Apply polymorphic types to fresh instances of their type parameters and store these instances in context.undetparams, unless followed by explicit type application. (4) Do the following to unapplied methods used as values: (4.1) If the method has only implicit parameters pass implicit arguments (4.2) otherwise, if pt is a function type and method is not a constructor, convert to function by eta-expansion, (4.3) otherwise, if the method is nullary with a result type compatible to pt and it is not a constructor, apply it to () otherwise issue an error (5) Convert constructors in a pattern as follows: (5.1) If constructor refers to a case class factory, set tree's type to the unique instance of its primary constructor that is a subtype of the expected type. (5.2) If constructor refers to an extractor, convert to application of unapply or unapplySeq method.

(6) Convert all other types to TypeTree nodes. (7) When in TYPEmode but not FUNmode or HKmode, check that types are fully parameterized (7.1) In HKmode, higher-kinded types are allowed, but they must have the expected kind-arity (8) When in both EXPRmode and FUNmode, add apply method calls to values of object type. (9) If there are undetermined type variables and not POLYmode, infer expression instance Then, if tree's type is not a subtype of expected type, try the following adaptations: (10) If the expected type is Byte, Short or Char, and the expression is an integer fitting in the range of that type, convert it to that type. (11) Widen numeric literals to their expected type, if necessary (12) When in mode EXPRmode, convert E to { E; () } if expected type is scala.Unit. (13) When in mode EXPRmode, apply AnnotationChecker conversion if expected type is annotated. (14) When in mode EXPRmode, apply a view If all this fails, error Parameters as for typedUnadapted.

Attributes

Definition Classes
Inherited from:
Checker
final def adapt(tree: Tree, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer

Tries to adapt NotNullInfos from creation context to the DefTree, returns whether the adaption took place. An adaption only takes place if the DefTree has a symbol and it has not been completed (is not forward referenced).

Tries to adapt NotNullInfos from creation context to the DefTree, returns whether the adaption took place. An adaption only takes place if the DefTree has a symbol and it has not been completed (is not forward referenced).

Attributes

Inherited from:
Typer
override def addCanThrowCapabilities(expr: Tree, cases: List[CaseDef])(using Context): Tree

Add givens reflecting CanThrow capabilities for all checked exceptions matched by cases. The givens appear in nested blocks with earlier cases leading to more deeply nested givens. This way, given priority will be the same as pattern priority. The functionality is enabled if the experimental.saferExceptions language feature is enabled.

Add givens reflecting CanThrow capabilities for all checked exceptions matched by cases. The givens appear in nested blocks with earlier cases leading to more deeply nested givens. This way, given priority will be the same as pattern priority. The functionality is enabled if the experimental.saferExceptions language feature is enabled.

Attributes

Definition Classes
Inherited from:
ReTyper
final def addChild(cls: Symbol, child: Symbol)(using Context): Unit

Add child annotation for child to annotations of cls. The annotation is added at the correct insertion point, so that Child annotations appear in reverse order of their start positions.

Add child annotation for child to annotations of cls. The annotation is added at the correct insertion point, so that Child annotations appear in reverse order of their start positions.

Attributes

Inherited from:
Namer
def addEnumConstants(mdef: DefTree, sym: Symbol)(using Context): Unit

Add java enum constants

Add java enum constants

Attributes

Inherited from:
Namer
def annotContext(mdef: Tree, sym: Symbol)(using Context): Context

The context to be used for an annotation of mdef. This should be the context enclosing mdef, or if mdef defines a parameter the context enclosing the owner of mdef. Furthermore, we need to make sure that annotation trees are evaluated with an owner that is not the enclosing class since otherwise locally defined symbols would be entered as class members.

The context to be used for an annotation of mdef. This should be the context enclosing mdef, or if mdef defines a parameter the context enclosing the owner of mdef. Furthermore, we need to make sure that annotation trees are evaluated with an owner that is not the enclosing class since otherwise locally defined symbols would be entered as class members.

Attributes

Inherited from:
Typer
def argCtx(app: Tree)(using Context): Context

If app is a this(...) constructor call, the this-call argument context, otherwise the current context.

If app is a this(...) constructor call, the this-call argument context, otherwise the current context.

Attributes

Inherited from:
Applications
def arrayToRepeated(tree: Tree)(using Context): Tree

Attributes

Inherited from:
TypeAssigner
def assertExists(tp: Type): Type

Attributes

Inherited from:
TypeAssigner

assert Java classes are not used as objects

assert Java classes are not used as objects

Attributes

Inherited from:
Checker
def assignType(tree: Hole, tpt: Tree)(using Context): Hole

Attributes

Inherited from:
TypeAssigner
def assignType(tree: PackageDef, pid: Tree)(using Context): PackageDef

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Annotated, arg: Tree, annot: Tree)(using Context): Annotated

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Export)(using Context): Export

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Import, sym: Symbol)(using Context): Import

Attributes

Inherited from:
TypeAssigner
def assignType(tree: TypeDef, sym: Symbol)(using Context): TypeDef

Attributes

Inherited from:
TypeAssigner
def assignType(tree: DefDef, sym: Symbol)(using Context): DefDef

Attributes

Inherited from:
TypeAssigner
def assignType(tree: ValDef, sym: Symbol)(using Context): ValDef

Attributes

Inherited from:
TypeAssigner
def assignType(tree: QuotePattern, proto: Type)(using Context): QuotePattern

Attributes

Inherited from:
TypeAssigner
def assignType(tree: UnApply, proto: Type)(using Context): UnApply

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Alternative, trees: List[Tree])(using Context): Alternative

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Bind, sym: Symbol)(using Context): Bind

Attributes

Inherited from:
TypeAssigner
def assignType(tree: TypeBoundsTree, lo: Tree, hi: Tree, alias: Tree)(using Context): TypeBoundsTree

Attributes

Inherited from:
TypeAssigner
def assignType(tree: ByNameTypeTree, result: Tree)(using Context): ByNameTypeTree

Attributes

Inherited from:
TypeAssigner
def assignType(tree: MatchTypeTree, bound: Tree, scrutinee: Tree, cases: List[CaseDef])(using Context): MatchTypeTree

Attributes

Inherited from:
TypeAssigner
def assignType(tree: LambdaTypeTree, tparamDefs: List[TypeDef], body: Tree)(using Context): LambdaTypeTree

Attributes

Inherited from:
TypeAssigner
def assignType(tree: AppliedTypeTree, tycon: Tree, args: List[Tree])(using Context): AppliedTypeTree

Attributes

Inherited from:
TypeAssigner
def assignType(tree: RefinedTypeTree, parent: Tree, refinements: List[Tree], refineCls: ClassSymbol)(using Context): RefinedTypeTree

Assign type of RefinedType. Refinements are typed as if they were members of refinement class refineCls.

Assign type of RefinedType. Refinements are typed as if they were members of refinement class refineCls.

Attributes

Inherited from:
TypeAssigner

Attributes

Inherited from:
TypeAssigner
def assignType(tree: SeqLiteral, elems: List[Tree], elemtpt: Tree)(using Context): SeqLiteral

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Try, expr: Tree, cases: List[CaseDef])(using Context): Try

Attributes

Inherited from:
TypeAssigner
def assignType(tree: WhileDo)(using Context): WhileDo

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Return)(using Context): Return

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Labeled)(using Context): Labeled

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Match, scrutinee: Tree, cases: List[CaseDef])(using Context): Match

Attributes

Inherited from:
TypeAssigner
def assignType(tree: CaseDef, pat: Tree, body: Tree)(using Context): CaseDef

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Closure, meth: Tree, target: Tree)(using Context): Closure

Attributes

Inherited from:
TypeAssigner
def assignType(tree: If, thenp: Tree, elsep: Tree)(using Context): If

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Inlined, bindings: List[Tree], expansion: Tree)(using Context): Inlined

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Block, stats: List[Tree], expr: Tree)(using Context): Block

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Assign)(using Context): Assign

Attributes

Inherited from:
TypeAssigner
def assignType(tree: NamedArg, arg: Tree)(using Context): NamedArg

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Typed, tpt: Tree)(using Context): Typed

Attributes

Inherited from:
TypeAssigner
def assignType(tree: TypeApply, fn: Tree, args: List[Tree])(using Context): TypeApply

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Apply, fn: Tree, args: List[Tree])(using Context): Apply

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Super, qual: Tree, mixinClass: Symbol)(using Context): Super

Attributes

Inherited from:
TypeAssigner
def assignType(tree: This)(using Context): This

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Literal)(using Context): Literal

Attributes

Inherited from:
TypeAssigner
def assignType(tree: New, tpt: Tree)(using Context): New

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Select, qual: Tree)(using Context): Select

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Select, tp: Type)(using Context): Select

Attributes

Inherited from:
TypeAssigner
def assignType(tree: Ident, tp: Type)(using Context): Ident

Type assignment method. Each method takes as parameters

Type assignment method. Each method takes as parameters

  • an untpd.Tree to which it assigns a type,
  • typed child trees it needs to access to cpmpute that type,
  • any further information it needs to access to compute that type.

Attributes

Inherited from:
TypeAssigner
def assumedCanEqual(ltp: Type, rtp: Type)(using Context): Boolean

A CanEqual[T, U] instance is assumed

A CanEqual[T, U] instance is assumed

  • if one of T, U is an error type, or
  • if one of T, U is a subtype of the lifted version of the other, unless strict equality is set.

Attributes

Inherited from:
Implicits
def avoidPrivateLeaks(sym: Symbol)(using Context): Type

Attributes

Inherited from:
TypeAssigner
def avoidingType(expr: Tree, bindings: List[Tree])(using Context): Type

Attributes

Inherited from:
TypeAssigner
def captureWildcardsCompat(tp: Type, pt: Type)(using Context): Type

Attributes

Inherited from:
Applications
override def checkAnnotApplicable(annot: Tree, sym: Symbol)(using Context): Boolean

check that annotation annot is applicable to symbol sym

check that annotation annot is applicable to symbol sym

Attributes

Definition Classes
Inherited from:
ReChecking
def checkAnnotArgs(tree: Tree)(using Context): tree.type

Check arguments of compiler-defined annotations

Check arguments of compiler-defined annotations

Attributes

Inherited from:
Checking
def checkAnnotClass(tree: Tree)(using Context): Tree

Check that the class corresponding to this tree is either a Scala or Java annotation.

Check that the class corresponding to this tree is either a Scala or Java annotation.

Attributes

Returns

The original tree or an error tree in case tree isn't a valid annotation or already an error tree.

Inherited from:
Checking
override def checkCanEqual(ltp: Type, rtp: Type, span: Span)(using Context): Unit

Check that equality tests between types ltp and rtp make sense

Check that equality tests between types ltp and rtp make sense

Attributes

Definition Classes
Inherited from:
ReTyper
override def checkCanThrow(tp: Type, span: Span)(using Context): Tree

Check that there is an implicit capability to throw a checked exception if the saferExceptions feature is turned on. Return that capability is it exists, EmptyTree otherwise.

Check that there is an implicit capability to throw a checked exception if the saferExceptions feature is turned on. Return that capability is it exists, EmptyTree otherwise.

Attributes

Definition Classes
Inherited from:
ReChecking
def checkCaseInheritance(parent: Symbol, caseCls: ClassSymbol, pos: SrcPos)(using Context): Unit

Check that case classes are not inherited by case classes.

Check that case classes are not inherited by case classes.

Attributes

Inherited from:
Checking
override def checkCatch(pat: Tree, guard: Tree)(using Context): Unit

Check that catch can generate a good CanThrow exception

Check that catch can generate a good CanThrow exception

Attributes

Definition Classes
Inherited from:
ReChecking
def checkClassType(tp: Type, pos: SrcPos, traitReq: Boolean, stablePrefixReq: Boolean)(using Context): Type

Check that tp is a class type. Also, if traitReq is true, check that tp is a trait. Also, if stablePrefixReq is true and phase is not after RefChecks, check that class prefix is stable.

Check that tp is a class type. Also, if traitReq is true, check that tp is a trait. Also, if stablePrefixReq is true and phase is not after RefChecks, check that class prefix is stable.

Attributes

Returns

tp itself if it is a class or trait ref, ObjectType if not.

Inherited from:
Checking
override def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(using Context): Unit

Verify classes extending AnyVal meet the requirements

Verify classes extending AnyVal meet the requirements

Attributes

Definition Classes
Inherited from:
Checker
override def checkEnum(cdef: TypeDef, cls: Symbol, firstParent: Symbol)(using Context): Unit
  1. Check that all case classes that extend scala.reflect.Enum are enum cases
  2. Check that parameterised enum cases do not extend java.lang.Enum.
  3. Check that only a static enum base class can extend java.lang.Enum.
  4. Check that user does not implement an ordinal method in the body of an enum class.

Attributes

Definition Classes
Inherited from:
ReChecking
override def checkEnumCaseRefsLegal(cdef: TypeDef, enumCtx: Context)(using Context): Unit

Check that all references coming from enum cases in an enum companion object are legal.

Check that all references coming from enum cases in an enum companion object are legal.

Value parameters

cdef

the enum companion object class

enumCtx

the context immediately enclosing the corresponding enum

Attributes

Definition Classes
Inherited from:
ReChecking
override def checkEnumParent(cls: Symbol, firstParent: Symbol)(using Context): Unit

Check that the firstParent for an enum case derives from the declaring enum class, if not, adds it as a parent after emitting an error.

Check that the firstParent for an enum case derives from the declaring enum class, if not, adds it as a parent after emitting an error.

This check will have no effect on simple enum cases as their parents are inferred by the compiler.

Attributes

Definition Classes
Inherited from:
ReChecking
def checkFeasibleParent(tp: Type, pos: SrcPos, where: => String)(using Context): Type

Check that tp is a class type and that any top-level type arguments in this type are feasible, i.e. that their lower bound conforms to their upper bound. If a type argument is infeasible, issue and error and continue with upper bound.

Check that tp is a class type and that any top-level type arguments in this type are feasible, i.e. that their lower bound conforms to their upper bound. If a type argument is infeasible, issue and error and continue with upper bound.

Attributes

Inherited from:
Checking
override def checkFeature(name: TermName, description: => String, featureUseSite: Symbol, pos: SrcPos)(using Context): Unit

Issue a feature warning if feature is not enabled

Issue a feature warning if feature is not enabled

Attributes

Definition Classes
Inherited from:
ReChecking
override def checkFullyAppliedType(tree: Tree)(using Context): Unit

Check that user-defined (result) type is fully applied

Check that user-defined (result) type is fully applied

Attributes

Definition Classes
Inherited from:
ReChecking

check Java classes are not used as objects

check Java classes are not used as objects

Attributes

Inherited from:
Checker

If sym is an old-style implicit conversion, check that implicit conversions are enabled.

If sym is an old-style implicit conversion, check that implicit conversions are enabled.

Attributes

Inherited from:
Checking
def checkImplicitConversionUseOK(tree: Tree, expected: Type)(using Context): Unit

If tree is an application of a new-style implicit conversion (using the apply method of a scala.Conversion instance), check that the expected type is annotated with @$into or that implicit conversions are enabled.

If tree is an application of a new-style implicit conversion (using the apply method of a scala.Conversion instance), check that the expected type is annotated with @$into or that implicit conversions are enabled.

Attributes

Inherited from:
Checking
def checkImportSelectors(qualType: Type, selectors: List[ImportSelector])(using Context): Unit

(1) Check that every named import selector refers to a type or value member of the qualifier type. (2) Check that no import selector is renamed more than once.

(1) Check that every named import selector refers to a type or value member of the qualifier type. (2) Check that no import selector is renamed more than once.

Attributes

Inherited from:
Checking
def checkInInlineContext(what: String, pos: SrcPos)(using Context): Unit

Check that we are in an inline context (inside an inline method or in inline code)

Check that we are in an inline context (inside an inline method or in inline code)

Attributes

Inherited from:
Checking
def checkIrrefutable(sel: Tree, pat: Tree, isPatDef: Boolean)(using Context): Boolean

Check that pattern pat is irrefutable for scrutinee type sel.tpe. This means sel is either marked @unchecked or sel.tpe conforms to the pattern's type. If pattern is an UnApply, also check that the extractor is irrefutable, and do the check recursively.

Check that pattern pat is irrefutable for scrutinee type sel.tpe. This means sel is either marked @unchecked or sel.tpe conforms to the pattern's type. If pattern is an UnApply, also check that the extractor is irrefutable, and do the check recursively.

Attributes

Inherited from:
Checking
def checkLegalExportPath(path: Tree, selectors: List[ImportSelector])(using Context): Unit

Check that path is a legal prefix for an export clause

Check that path is a legal prefix for an export clause

Attributes

Inherited from:
Checking
def checkLegalImportPath(path: Tree)(using Context): Unit

Check that path is a legal prefix for an import clause

Check that path is a legal prefix for an import clause

Attributes

Inherited from:
Checking
override def checkMatchable(tp: Type, pos: SrcPos, pattern: Boolean)(using Context): Unit

Attributes

Definition Classes
Inherited from:
ReChecking
def checkMembersOK(tp: Type, pos: SrcPos)(using Context): Type

Check that all named types that form part of this type have a denotation. Called on inferred (result) types of ValDefs and DefDefs. This could fail for types where the member was originally available as part of the self type, yet is no longer visible once the this has been replaced by some other prefix. See neg/i3083.scala

Check that all named types that form part of this type have a denotation. Called on inferred (result) types of ValDefs and DefDefs. This could fail for types where the member was originally available as part of the self type, yet is no longer visible once the this has been replaced by some other prefix. See neg/i3083.scala

Attributes

Inherited from:
Checking
def checkNoConflict(name: Name, isPrivate: Boolean, span: Span)(using Context): Name

Check that a new definition with given name and privacy status in current context would not conflict with existing currently compiled definitions. The logic here is very subtle and fragile due to the fact that we are not allowed to force anything.

Check that a new definition with given name and privacy status in current context would not conflict with existing currently compiled definitions. The logic here is very subtle and fragile due to the fact that we are not allowed to force anything.

Attributes

Inherited from:
Namer
override def checkNoContextFunctionType(tree: Tree)(using Context): Unit

Check that tree does not define a context function type

Check that tree does not define a context function type

Attributes

Definition Classes
Inherited from:
ReChecking

Check that class does not declare same symbol twice

Check that class does not declare same symbol twice

Attributes

Inherited from:
Checking

Check that method parameter types do not reference their own parameter or later parameters in the same parameter section.

Check that method parameter types do not reference their own parameter or later parameters in the same parameter section.

Attributes

Inherited from:
Checking
override def checkNoModuleClash(sym: Symbol)(using Context): Unit

Check that module sym does not clash with a class of the same name that is concurrently compiled in another source file.

Check that module sym does not clash with a class of the same name that is concurrently compiled in another source file.

Attributes

Definition Classes
Inherited from:
ReChecking

Check that symbol's external name does not clash with symbols defined in the same scope

Check that symbol's external name does not clash with symbols defined in the same scope

Attributes

Inherited from:
Checking
def checkNonCyclic(sym: Symbol, info: TypeBounds, reportErrors: Boolean)(using Context): Type

Attributes

Inherited from:
Checking
def checkNonCyclicInherited(joint: Type, parents: List[Type], decls: Scope, pos: SrcPos)(using Context): Unit

Attributes

Inherited from:
Checking
def checkNonRootName(name: Name, nameSpan: Span)(using Context): Unit

Check that the definition name isn't root.

Check that the definition name isn't root.

Attributes

Inherited from:
Checking
def checkNotRepeated(tree: Tree)(using Context): tree.type

Attributes

Inherited from:
Checker
def checkParentCall(call: Tree, caller: ClassSymbol)(using Context): Unit

Attributes

Inherited from:
Checking
def checkRealizableBounds(cls: Symbol, pos: SrcPos)(using Context): Unit

Check that all type members of tp have realizable bounds

Check that all type members of tp have realizable bounds

Attributes

Inherited from:
Checking
override def checkRefsLegal(tree: Tree, badOwner: Symbol, allowed: (Name, Symbol) => Boolean, where: String)(using Context): Unit

Check that all non-synthetic references of the form <ident> or this.<ident> in tree that refer to a member of badOwner are allowed. Also check that there are no other explicit this references to badOwner.

Check that all non-synthetic references of the form <ident> or this.<ident> in tree that refer to a member of badOwner are allowed. Also check that there are no other explicit this references to badOwner.

Attributes

Definition Classes
Inherited from:
ReChecking
def checkSimpleKinded(tpt: Tree)(using Context): Tree

Check that tpt does not define a higher-kinded type

Check that tpt does not define a higher-kinded type

Attributes

Inherited from:
Checking
def checkStable(tp: Type, pos: SrcPos, kind: String)(using Context): Unit

Check that type tp is stable.

Check that type tp is stable.

Attributes

Inherited from:
Checking
def checkSuper(tree: Tree)(implicit ctx: Context): Unit

Check that all invariants related to Super and SuperType are met

Check that all invariants related to Super and SuperType are met

Attributes

Inherited from:
Checker
def checkValidInfix(tree: InfixOp, meth: Symbol)(using Context): Unit

Check that tree is a valid infix operation. That is, if the operator is alphanumeric, it must be declared infix.

Check that tree is a valid infix operation. That is, if the operator is alphanumeric, it must be declared infix.

Attributes

Inherited from:
Checking
def compare(alt1: TermRef, alt2: TermRef)(using Context): Int

Compare two alternatives of an overloaded call or an implicit search.

Compare two alternatives of an overloaded call or an implicit search.

Value parameters

alt1,

alt2 Non-overloaded references indicating the two choices

Attributes

Returns

1 if 1st alternative is preferred over 2nd -1 if 2nd alternative is preferred over 1st 0 if neither alternative is preferred over the other Normal symbols are always preferred over constructor proxies. Otherwise, an alternative A1 is preferred over an alternative A2 if it wins in a tournament that awards one point for each of the following:

  • A1's owner derives from A2's owner.
  • A1's type is more specific than A2's type. If that tournament yields a draw, a tiebreak is applied where an alternative that takes more implicit parameters wins over one that takes fewer.
Inherited from:
Applications
def compareOwner(sym1: Symbol, sym2: Symbol)(using Context): Int

Compare owner inheritance level.

Compare owner inheritance level.

Value parameters

sym1

The first owner

sym2

The second owner

Attributes

Returns

1 if sym1 properly derives from sym2 -1 if sym2 properly derives from sym1 0 otherwise Module classes also inherit the relationship from their companions. This means, if no direct derivation exists between sym1 and sym2 also perform the following tests:

  • If both sym1 and sym1 are module classes that have companion classes, and sym2 does not inherit implicit members from a base class (#), compare the companion classes.
  • If sym1 is a module class with a companion, and sym2 is a normal class or trait, compare the companion with sym2. Condition (#) is necessary to make compareOwner(_, _) > 0 a transitive relation. For instance: class A extends B object A { given a ... } class B object B extends C { given b ... } class C { given c } Then without (#), and taking A$ for the module class of A, compareOwner(A$, B$) = 1 and compareOwner(B$, C) == 1, but compareOwner(A$, C) == 0. Violating transitivity in this way is bad, since it makes implicit search outcomes compilation order dependent. E.g. if we compare b with c first, we pick b. Then, if we compare a and b, we pick a as solution of the search. But if we start with comparing a with c, we get an ambiguity. With the added condition (#), compareOwner(A$, B$) == 0. This means we get an ambiguity between a and b in all cases.
Inherited from:
Applications
override def completeAnnotations(mdef: MemberDef, sym: Symbol)(using Context): Unit

Attributes

Definition Classes
Inherited from:
ReTyper
def completeParams(params: List[MemberDef])(using Context): Unit

Enter and typecheck parameter list

Enter and typecheck parameter list

Attributes

Inherited from:
Namer
def completeTypeTree(tree: TypeTree, pt: Type, original: Tree)(using Context): TypeTree

Attributes

Inherited from:
Typer
def constrainResult(meth: Symbol, mt: Type, pt: Type)(using Context): Boolean

Constrain result with special case if meth is an inlineable method in an inlineable context. In that case, we should always succeed and not constrain type parameters in the expected type, because the actual return type can be a subtype of the currently known return type. However, we should constrain parameters of the declared return type. This distinction is achieved by replacing expected type parameters with wildcards.

Constrain result with special case if meth is an inlineable method in an inlineable context. In that case, we should always succeed and not constrain type parameters in the expected type, because the actual return type can be a subtype of the currently known return type. However, we should constrain parameters of the declared return type. This distinction is achieved by replacing expected type parameters with wildcards.

Attributes

Inherited from:
Compatibility
def constrainResult(mt: Type, pt: Type)(using Context): Boolean

Check that the result type of the current method fits the given expected result type.

Check that the result type of the current method fits the given expected result type.

Attributes

Inherited from:
Compatibility
def contextBoundParams(tree: Tree, tp: Type, pt: FunProto)(using Context): Unit

Flag & migrate explicit normal arguments to parameters coming from context bounds Warning in 3.4, error in 3.5, rewrite in 3.5-migration.

Flag & migrate explicit normal arguments to parameters coming from context bounds Warning in 3.4, error in 3.5, rewrite in 3.5-migration.

Attributes

Inherited from:
Migrations

Rewrite new Array[T](....) if T is an unbounded generic to calls to newGenericArray. It is performed during typer as creation of generic arrays needs a classTag. we rely on implicit search to find one.

Rewrite new Array[T](....) if T is an unbounded generic to calls to newGenericArray. It is performed during typer as creation of generic arrays needs a classTag. we rely on implicit search to find one.

Attributes

Inherited from:
Applications
def createSymbol(tree: Tree)(using Context): Symbol

If this tree is a member def or an import, create a symbol of it and store in symOfTree map.

If this tree is a member def or an import, create a symbol of it and store in symOfTree map.

Attributes

Inherited from:
Namer
def defDefSig(ddef: DefDef, sym: Symbol, completer: Namer#Completer)(using Context): Type

The type signature of a DefDef with given symbol

The type signature of a DefDef with given symbol

Attributes

Inherited from:
Namer
def enclosingClassNamed(name: TypeName, span: Span)(using Context): Symbol

The enclosing class with given name; error if none exists

The enclosing class with given name; error if none exists

Attributes

Inherited from:
Namer
def ensureAccessible(tpe: Type, superAccess: Boolean, pos: SrcPos)(using Context): Type

Try to make tpe accessible, emit error if not possible

Try to make tpe accessible, emit error if not possible

Attributes

Inherited from:
TypeAssigner
override def ensureConstrCall(cls: ClassSymbol, parent: Tree, psym: Symbol)(using Context): Tree

Turn a parent type into a constructor call where needed. This is the case where

Turn a parent type into a constructor call where needed. This is the case where

  • we are in a Scala class or module (not a Java class, nor a trait), and
    • the parent symbol is a non-trait class, or
    • the parent symbol is a trait that takes at least one (explicit or implicit) parameter and the parent symbol is directly extended by the current class (i.e. not extended by the superclass).

Attributes

Definition Classes
Inherited from:
ReTyper
def ensureFirstIsClass(cls: ClassSymbol, parents: List[Type])(using Context): List[Type]

Ensure that the first type in a list of parent types Ps points to a non-trait class. If that's not already the case, add one. The added class type CT is determined as follows. First, let C be the unique class such that

Ensure that the first type in a list of parent types Ps points to a non-trait class. If that's not already the case, add one. The added class type CT is determined as follows. First, let C be the unique class such that

  • there is a parent P_i such that P_i derives from C, and
  • for every class D: If some parent P_j, j <= i derives from D, then C derives from D. Then, let CT be the smallest type which
  • has C as its class symbol, and
  • for all parents P_i: If P_i derives from C then P_i <:< CT.

Tweak: It could be that at the point where the method is called, some superclass is still missing its parents. Parents are set to Nil when completion starts and are set to the actual parents later. If a superclass completes a subclass in one of its parents, the parents of the superclass or some intervening class might not yet be set. This situation can be detected by asking for the baseType of Any - if that type does not exist, one of the base classes of this class misses its parents. If this situation arises, the computation of the superclass might be imprecise. For instance, in i12722.scala, the superclass of IPersonalCoinOps is computed as Object, where JsObject would be correct. The problem cannot be solved locally, but we detect the situaton and mark the superclass with a @ProvisionalSuperClass annotation in this case. When typechecking the class, we then run ensureFirstIsClass again and possibly improve the computed super class. An alternatiev fix would compute superclasses at typer instead at completion. But that breaks too many invariants. For instance, we rely on correct @Child annotations after completion, and these in turn need the superclass.

Attributes

Inherited from:
Namer
override def ensureNoLocalRefs(tree: Tree, pt: Type, localSyms: => List[Symbol])(using Context): Tree

Ensure that an expression's type can be expressed without references to locally defined symbols. This is done by adding a type ascription of a widened type that does not refer to the locally defined symbols. The widened type is computed using TyperAssigner#avoid. However, if the expected type is fully defined and not a supertype of the widened type, we ascribe with the expected type instead.

Ensure that an expression's type can be expressed without references to locally defined symbols. This is done by adding a type ascription of a widened type that does not refer to the locally defined symbols. The widened type is computed using TyperAssigner#avoid. However, if the expected type is fully defined and not a supertype of the widened type, we ascribe with the expected type instead.

There's a special case having to do with anonymous classes. Sometimes the expected type of a block is the anonymous class defined inside it. In that case there's technically a leak which is not removed by the ascription.

Attributes

Definition Classes
Inherited from:
Checker
def enterSymbol(sym: Symbol)(using Context): Unit

If sym exists, enter it in effective scope. Check that package members are not entered twice in the same run.

If sym exists, enter it in effective scope. Check that package members are not entered twice in the same run.

Attributes

Inherited from:
Namer
def escapingRefs(block: Tree, localSyms: => List[Symbol])(using Context): List[NamedType]

Attributes

Inherited from:
Typer
override def excludeFromDoubleDeclCheck(sym: Symbol)(using Context): Boolean

Exclude from double definition checks any erased symbols that were made private in phase UnlinkErasedDecls. These symbols will be removed completely in phase Erasure if they are defined in a currently compiled unit.

Exclude from double definition checks any erased symbols that were made private in phase UnlinkErasedDecls. These symbols will be removed completely in phase Erasure if they are defined in a currently compiled unit.

Attributes

Definition Classes
Inherited from:
Checker
def expand(tree: Tree)(using Context): Unit

Expand tree and store in expandedTree

Expand tree and store in expandedTree

Attributes

Inherited from:
Namer
def expanded(tree: Tree)(using Context): Tree

The expanded version of this tree, or tree itself if not expanded

The expanded version of this tree, or tree itself if not expanded

Attributes

Inherited from:
Namer
def extMethodApply(methodRef: Tree, receiver: Tree, pt: Type)(using Context): Tree

The typed application

The typed application

( ) or

where comes from pt if it is a (possibly ignored) PolyProto.

Attributes

Inherited from:
Applications
def findRef(name: Name, pt: Type, required: FlagSet, excluded: FlagSet, pos: SrcPos, altImports: ListBuffer[TermRef] | Null)(using Context): Type

Find the type of an identifier with given name in given context ctx.

Find the type of an identifier with given name in given context ctx.

Value parameters

altImports

a ListBuffer in which alternative imported references are collected in case findRef is called from an expansion of an extension method, i.e. when e.m is expanded to m(e) and a reference for m is searched. null in all other situations.

excluded

flags the result's symbol must not have

name

the name of the identifier

pos

indicates position to use for error reporting

pt

the expected type

required

flags the result's symbol must have

Attributes

Inherited from:
Typer
def handleStructural(tree: Tree)(using Context): Tree

Handle reflection-based dispatch for members of structural types.

Handle reflection-based dispatch for members of structural types.

Given x.a, where x is of (widened) type T (a value type or a nullary method type), and x.a is of type U, map x.a to the equivalent of:

x1.selectDynamic("a").asInstanceOf[U]

where x1 is x adapted to Selectable.

Given x.a(a11, ..., a1n)...(aN1, ..., aNn), where x.a is of (widened) type (T11, ..., T1n)...(TN1, ..., TNn): R, it is desugared to:

x1.applyDynamic("a")(a11, ..., a1n, ..., aN1, ..., aNn)
  .asInstanceOf[R]

If this call resolves to an applyDynamic method that takes a Class[?]* as second parameter, we further rewrite this call to scala

x1.applyDynamic("a", c11, ..., c1n, ..., cN1, ... cNn)
                (a11, ..., a1n, ..., aN1, ..., aNn)
  .asInstanceOf[R]

where c11, ..., cNn are the classOf constants representing the erasures of T11, ..., TNn.

It's an error if U is neither a value nor a method type, or a dependent method type

Attributes

Inherited from:
Dynamic
override def handleUnexpectedFunType(tree: Apply, fun: Tree)(using Context): Tree

Overridden in ReTyper to handle primitive operations that can be generated after erasure

Overridden in ReTyper to handle primitive operations that can be generated after erasure

Attributes

Definition Classes
Inherited from:
ReTyper
def harmonic[T](harmonize: (List[T]) => List[T], pt: Type)(op: => List[T])(using Context): List[T]

Apply a transformation harmonize on the results of operation op, unless the expected type pt is fully defined. If the result is different (wrt eq) from the original results of op, revert back to the constraint in force before computing op. This reset is needed because otherwise the original results might have added constraints to type parameters which are no longer implied after harmonization. No essential constraints are lost by this because the result of harmonization will be compared again with the expected type. Test cases where this matters are in neg/harmomize.scala and run/weak-conformance.scala.

Apply a transformation harmonize on the results of operation op, unless the expected type pt is fully defined. If the result is different (wrt eq) from the original results of op, revert back to the constraint in force before computing op. This reset is needed because otherwise the original results might have added constraints to type parameters which are no longer implied after harmonization. No essential constraints are lost by this because the result of harmonization will be compared again with the expected type. Test cases where this matters are in neg/harmomize.scala and run/weak-conformance.scala.

Note: this assumes that the internal typing of the arguments using op does not leave any constraints, so the only info that is reset is the relationship between the argument's types and the expected type. I am not sure this will always be the case. If that property does not hold, we risk forgetting constraints which could lead to unsoundness.

Attributes

Inherited from:
Applications
def harmonize(trees: List[Tree])(using Context): List[Tree]

If trees all have numeric value types, and they do not have all the same type, pick a common numeric supertype and try to convert all constant Int literals to this type. If the resulting trees all have the same type, return them instead of the original ones.

If trees all have numeric value types, and they do not have all the same type, pick a common numeric supertype and try to convert all constant Int literals to this type. If the resulting trees all have the same type, return them instead of the original ones.

Attributes

Inherited from:
Applications
def hasDefinedSymbol(tree: Tree)(using Context): Boolean

Attributes

Inherited from:
Namer
def hasExtensionMethodNamed(tp: Type, xname: TermName, argType: Type, resultType: Type)(using Context): Boolean

Does tp have an extension method named xname with this-argument argType and result matching resultType?

Does tp have an extension method named xname with this-argument argType and result matching resultType?

Attributes

Inherited from:
Applications

True if this inline typer has already issued errors

True if this inline typer has already issued errors

Attributes

Inherited from:
Typer
def implicitArgTree(formal: Type, span: Span)(using Context): Tree

Search an implicit argument and report error if not found

Search an implicit argument and report error if not found

Attributes

Inherited from:
Implicits
def implicitParamString(paramName: TermName, methodStr: String, tree: Tree)(using Context): String

A string indicating the formal parameter corresponding to a missing argument

A string indicating the formal parameter corresponding to a missing argument

Attributes

Inherited from:
Implicits
def importBound(sels: List[ImportSelector], isGiven: Boolean)(using Context): Type

The type bound on wildcard imports of an import list, with special values Nothing if no wildcard imports of this kind exist Any if there are unbounded wildcard imports of this kind

The type bound on wildcard imports of an import list, with special values Nothing if no wildcard imports of this kind exist Any if there are unbounded wildcard imports of this kind

Attributes

Inherited from:
Namer
override def importSuggestionAddendum(pt: Type)(using Context): String

An addendum to an error message where the error might be fixed by some implicit value of type pt that is however not found. The addendum suggests given imports that might fix the problem. If there's nothing to suggest, an empty string is returned.

An addendum to an error message where the error might be fixed by some implicit value of type pt that is however not found. The addendum suggests given imports that might fix the problem. If there's nothing to suggest, an empty string is returned.

Attributes

Definition Classes
Inherited from:
ImportSuggestions
def inaccessibleErrorType(tpe: NamedType, superAccess: Boolean, pos: SrcPos)(using Context): Type

Attributes

Inherited from:
TypeAssigner
override def index(trees: List[Tree])(using Context): Context

Create top-level symbols for statements and enter them into symbol table

Create top-level symbols for statements and enter them into symbol table

Attributes

Returns

A context that reflects all imports in stats.

Definition Classes
Inherited from:
ReTyper
def index(stat: Tree)(using Context): Context

Expand tree and create top-level symbols for statement and enter them into symbol table

Expand tree and create top-level symbols for statement and enter them into symbol table

Attributes

Inherited from:
Namer
def indexExpanded(origStat: Tree)(using Context): Context

Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table

Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table

Attributes

Inherited from:
Namer
def inferImplicit(pt: Type, argument: Tree, span: Span)(using Context): SearchResult

Find an implicit parameter or conversion.

Find an implicit parameter or conversion.

Value parameters

argument

If an implicit conversion is searched, the argument to which it should be applied, EmptyTree otherwise.

pt

The expected type of the parameter or conversion.

span

The position where errors should be reported.

Attributes

Inherited from:
Implicits
def inferImplicitArg(formal: Type, span: Span)(using Context): Tree

Find an implicit argument for parameter formal. Return a failure as a SearchFailureType in the type of the returned tree.

Find an implicit argument for parameter formal. Return a failure as a SearchFailureType in the type of the returned tree.

Attributes

Inherited from:
Implicits
override def inferView(from: Tree, to: Type)(using Context): SearchResult

Find an implicit conversion to apply to given tree from so that the result is compatible with type to.

Find an implicit conversion to apply to given tree from so that the result is compatible with type to.

Attributes

Definition Classes
Inherited from:
ReTyper
def inferredFromTarget(param: ValDef, formal: Type, calleeType: Type, isErased: Boolean, paramIndex: Name => Int)(using Context): Type

The parameter type for a parameter in a lambda that does not have an explicit type given, and where the type is not known from the context. In this case the parameter type needs to be inferred the "target type" T known from the callee f if the lambda is of a form like x => f(x). If T exists, we know that S <: I <: T.

The parameter type for a parameter in a lambda that does not have an explicit type given, and where the type is not known from the context. In this case the parameter type needs to be inferred the "target type" T known from the callee f if the lambda is of a form like x => f(x). If T exists, we know that S <: I <: T.

The inference makes two attempts:

  1. Compute the target type T and make it known that S <: T. If the expected type S can be fully defined under ForceDegree.flipBottom, pick this one (this might use the fact that S <: T for an upper approximation).
  2. Otherwise, if the target type T can be fully defined under ForceDegree.flipBottom, pick this one.

If both attempts fail, return NoType.

Attributes

Inherited from:
Typer
def inferredResultType(mdef: ValOrDefDef, sym: Symbol, paramss: List[List[Symbol]], paramFn: Type => Type, fallbackProto: Type)(using Context): Type

Attributes

Inherited from:
Namer
override def inlineExpansion(mdef: DefDef)(using Context): List[Tree]

Given an inline method mdef, the method rewritten so that its body uses accessors to access non-public members. Also, if the inline method is retained, add a method to record the retained version of the body. Overwritten in Retyper to return mdef unchanged.

Given an inline method mdef, the method rewritten so that its body uses accessors to access non-public members. Also, if the inline method is retained, add a method to record the retained version of the body. Overwritten in Retyper to return mdef unchanged.

Attributes

Definition Classes
Inherited from:
ReTyper

If the prototype pt is the type lambda (when doing a dependent typing of a match), instantiate that type lambda with the pattern variables found in the pattern pat.

If the prototype pt is the type lambda (when doing a dependent typing of a match), instantiate that type lambda with the pattern variables found in the pattern pat.

Attributes

Inherited from:
Typer
def interpolateTypeVars(tree: Tree, pt: Type, locked: TypeVars)(using Context): tree.type

Interpolate undetermined type variables in the widened type of this tree.

Interpolate undetermined type variables in the widened type of this tree.

Value parameters

locked

the set of type variables of the current typer state that cannot be interpolated at the present time Eligible for interpolation are all type variables owned by the current typerstate that are not in locked and whose nestingLevel is >= ctx.nestingLevel. Type variables occurring co- (respectively, contra-) variantly in the tree type or expected type are minimized (respectively, maximized). Non occurring type variables are minimized if they have a lower bound different from Nothing, maximized otherwise. Type variables appearing non-variantly in the type are left untouched. Note that even type variables that do not appear directly in a type, can occur with some variance in the type, because of the constraints. E.g if X occurs co-variantly in T and we have a constraint Y <: X Then Y also occurs co-variantly in T because it needs to be minimized in order to constrain T the least. See variances for more detail.

pt

the expected result type

tree

the tree whose type is interpolated

Attributes

Inherited from:
Inferencing
def invalidateCompanions(pkg: Symbol, xstats: List[Tree])(using Context): Unit

For all class definitions stat in xstats: If the companion class is not also defined in xstats, invalidate it by setting its info to NoType.

For all class definitions stat in xstats: If the companion class is not also defined in xstats, invalidate it by setting its info to NoType.

Attributes

Inherited from:
Namer
def isApplicableExtensionMethod(methodRef: TermRef, receiverType: Type)(using Context): Boolean

Attributes

Inherited from:
Applications
def isApplicableMethodRef(methRef: TermRef, args: List[Type], resultType: Type, argMatch: ArgMatch)(using Context): Boolean

Is given method reference applicable to argument types args?

Is given method reference applicable to argument types args?

Value parameters

resultType

The expected result type of the application

Attributes

Inherited from:
Applications
def isApplicableMethodRef(methRef: TermRef, args: List[Tree], resultType: Type, keepConstraint: Boolean, argMatch: ArgMatch)(using Context): Boolean

Is given method reference applicable to argument trees args?

Is given method reference applicable to argument trees args?

Value parameters

resultType

The expected result type of the application

Attributes

Inherited from:
Applications
def isApplicableType(tp: Type, args: List[Type], resultType: Type)(using Context): Boolean

Is given type applicable to argument types args, possibly after inserting an apply?

Is given type applicable to argument types args, possibly after inserting an apply?

Value parameters

resultType

The expected result type of the application

Attributes

Inherited from:
Applications
def isApplicableType(tp: Type, args: List[Tree], resultType: Type, keepConstraint: Boolean)(using Context): Boolean

Is given type applicable to argument trees args, possibly after inserting an apply?

Is given type applicable to argument trees args, possibly after inserting an apply?

Value parameters

resultType

The expected result type of the application

Attributes

Inherited from:
Applications
def isApplyProto(pt: Type)(using Context): Boolean

Is pt a prototype of an apply selection, or a parameterless function yielding one?

Is pt a prototype of an apply selection, or a parameterless function yielding one?

Attributes

Inherited from:
Typer
def isCompatible(tp: Type, pt: Type)(using Context): Boolean

A type tp is compatible with a type pt if one of the following holds:

A type tp is compatible with a type pt if one of the following holds:

  1. tp is a subtype of pt
  2. pt is by name parameter type, and tp is compatible with its underlying type
  3. there is an implicit conversion from tp to pt.
  4. tp is a numeric subtype of pt (this case applies even if implicit conversions are disabled) If pt is a by-name type, we compare against the underlying type instead.

Attributes

Inherited from:
Compatibility

Determines whether this field holds an enum constant.

Determines whether this field holds an enum constant.

Attributes

Inherited from:
Namer
def isMethodType(pt: Type)(using Context): Boolean

Check that all methods have MethodicType

Check that all methods have MethodicType

Attributes

Inherited from:
Checker
def isUnary(tp: Type)(using Context): Boolean

Is tp a unary function type or an overloaded type with with only unary function types as alternatives?

Is tp a unary function type or an overloaded type with with only unary function types as alternatives?

Attributes

Inherited from:
Applications
def kindProjectorQMark(tree: TypeDef, sym: Symbol)(using Context): Unit

Flag & migrate ? used as a higher-kinded type parameter Warning in 3.0-migration, error from 3.0

Flag & migrate ? used as a higher-kinded type parameter Warning in 3.0-migration, error from 3.0

Attributes

Inherited from:
Migrations
def lateEnterUnit(typeCheck: Boolean)(typeCheckCB: (() => Unit) => Unit)(using Context): Unit

Parse the source and index symbols in the compilation unit's untpdTree while asserting the lateCompile flag. This will cause any old top-level symbol with the same fully qualified name as a newly created symbol to be replaced.

Parse the source and index symbols in the compilation unit's untpdTree while asserting the lateCompile flag. This will cause any old top-level symbol with the same fully qualified name as a newly created symbol to be replaced.

Will call the callback with an implementation of type checking That will set the tpdTree and root tree for the compilation unit.

Attributes

Inherited from:
Namer
override def localDummy(cls: ClassSymbol, impl: Template)(using Context): Symbol

Attributes

Definition Classes
Inherited from:
ReTyper
override def localTyper(sym: Symbol): Typer

Attributes

Definition Classes
Inherited from:
ReTyper
def maybeSkolemizePrefix(qualType: Type, name: Name)(using Context): Type

Return a potentially skolemized version of qualTpe to be used as a prefix when selecting name.

Return a potentially skolemized version of qualTpe to be used as a prefix when selecting name.

Attributes

See also

QualSkolemType, TypeOps#asSeenFrom

Inherited from:
TypeAssigner
inline def migrate(inline migration: Unit): Unit

Run migration, provided we are in the proper Typer (not a ReTyper)

Run migration, provided we are in the proper Typer (not a ReTyper)

Attributes

Inherited from:
Migrations
inline def migrate[T](inline migration: T): T

Run migration, asserting we are in the proper Typer (not a ReTyper)

Run migration, asserting we are in the proper Typer (not a ReTyper)

Attributes

Inherited from:
Migrations
def missingArgMsg(arg: Tree, pt: Type, where: String, paramSymWithMethodCallTree: Option[(Symbol, Tree)])(using Context): Message

Value parameters

arg

Tree representing a failed result of implicit search

paramSymWithMethodCallTree

Symbol of the parameter for which the implicit was searched and tree of the method call that triggered the implicit search

pt

Type for which an implicit value was searched

where

Description of where the search was performed. Might be empty

Attributes

Inherited from:
Implicits
def missingType(sym: Symbol, modifier: String)(using Context): Unit

Attributes

Inherited from:
Namer
def moduleValSig(sym: Symbol)(using Context): Type

The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the ValDef. This is necessary to avoid cyclic references involving imports and module val defs.

The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the ValDef. This is necessary to avoid cyclic references involving imports and module val defs.

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Applications

Like normalize and then isCompatible, but using a subtype comparison with necessary eithers that does not unnecessarily truncate the constraint space, returning false instead.

Like normalize and then isCompatible, but using a subtype comparison with necessary eithers that does not unnecessarily truncate the constraint space, returning false instead.

Attributes

Inherited from:
Compatibility
def needsTupledDual(funType: Type, pt: FunProto)(using Context): Boolean

Should we tuple or untuple the argument before application? If auto-tupling is enabled then

Should we tuple or untuple the argument before application? If auto-tupling is enabled then

  • we tuple n-ary arguments where n > 0 if the function consists only of unary alternatives
  • we untuple tuple arguments of infix operations if the function does not consist only of unary alternatives.

Attributes

Inherited from:
Applications
def newLikeThis(nestingLevel: Int): Typer

Attributes

Inherited from:
Typer
def normalizedCompatible(tp: Type, pt: Type, keepConstraint: Boolean)(using Context): Boolean

Test compatibility after normalization. If keepConstraint is false, the current constraint set will not be modified by this call.

Test compatibility after normalization. If keepConstraint is false, the current constraint set will not be modified by this call.

Attributes

Inherited from:
Compatibility
def notAMemberErrorType(tree: Select, qual: Tree, proto: Type)(using Context): ErrorType

Attributes

Inherited from:
TypeAssigner
def prepareRhsCtx(rhsCtx: FreshContext, paramss: List[List[Symbol]])(using Context): FreshContext

Prepare a GADT-aware context used to type the RHS of a ValOrDefDef.

Prepare a GADT-aware context used to type the RHS of a ValOrDefDef.

Attributes

Inherited from:
Namer
def processAppliedType(tree: Tree, tp: Type)(using Context): Type

Attributes

Inherited from:
TypeAssigner
def qualifyingClass(tree: Tree, qual: Name, packageOK: Boolean)(using Context): Symbol

The qualifying class of a this or super with prefix qual (which might be empty).

The qualifying class of a this or super with prefix qual (which might be empty).

Value parameters

packageOK

The qualifier may refer to a package.

Attributes

Inherited from:
TypeAssigner
final def reallyExists(denot: Denotation)(using Context): Boolean

A denotation exists really if it exists and does not point to a stale symbol.

A denotation exists really if it exists and does not point to a stale symbol.

Attributes

Inherited from:
TypeAssigner
def recordSym(sym: Symbol, tree: Tree)(using Context): Symbol

Record sym as the symbol defined by tree

Record sym as the symbol defined by tree

Attributes

Inherited from:
Namer
def registerNowarn(tree: Tree, mdef: Tree)(using Context): Unit

Attributes

Inherited from:
Typer
def resolveMapped(alts: List[TermRef], f: TermRef => Type, pt: Type)(using Context): List[TermRef]

Resolve overloading by mapping to a different problem where each alternative's type is mapped with f, alternatives with non-existing types are dropped, and the expected type is pt. Map the results back to the original alternatives.

Resolve overloading by mapping to a different problem where each alternative's type is mapped with f, alternatives with non-existing types are dropped, and the expected type is pt. Map the results back to the original alternatives.

Attributes

Inherited from:
Applications
def resolveOverloaded(alts: List[TermRef], pt: Type)(using Context): List[TermRef]

Resolve overloaded alternative alts, given expected type pt. Two trials: First, without implicits or SAM conversions enabled. Then, if the first finds no eligible candidates, with implicits and SAM conversions enabled.

Resolve overloaded alternative alts, given expected type pt. Two trials: First, without implicits or SAM conversions enabled. Then, if the first finds no eligible candidates, with implicits and SAM conversions enabled.

Attributes

Inherited from:
Applications
override def retrieveSym(tree: Tree)(using Context): Symbol

Retrieve symbol attached to given tree

Retrieve symbol attached to given tree

Attributes

Definition Classes
Inherited from:
ReTyper
def safeSubstMethodParams(mt: MethodType, argTypes: List[Type])(using Context): Type

Attributes

Inherited from:
TypeAssigner
def safeSubstParam(tp: Type, pref: ParamRef, argType: Type)(using Context): Type

Substitute argument type argType for parameter pref in type tp, skolemizing the argument type if it is not stable and pref occurs in tp.

Substitute argument type argType for parameter pref in type tp, skolemizing the argument type if it is not stable and pref occurs in tp.

Attributes

Inherited from:
TypeAssigner
def safeSubstParams(tp: Type, params: List[ParamRef], argTypes: List[Type])(using Context): Type

Substitute types of all arguments args for corresponding params in tp. The number of parameters params may exceed the number of arguments. In this case, only the common prefix is substituted.

Substitute types of all arguments args for corresponding params in tp. The number of parameters params may exceed the number of arguments. In this case, only the common prefix is substituted.

Attributes

Inherited from:
TypeAssigner
def saysNotFound(state: TyperState, memberName: Name)(using Context): Boolean

Does state contain a "NotAMember" or "MissingIdent" message as first pending error message? That message would be $memberName is not a member of ... or Not found: $memberName. If memberName is empty, any name will do.

Does state contain a "NotAMember" or "MissingIdent" message as first pending error message? That message would be $memberName is not a member of ... or Not found: $memberName. If memberName is empty, any name will do.

Attributes

Inherited from:
Applications
def selectionType(tree: RefTree, qual1: Tree)(using Context): Type

The type of the selection tree, where qual1 is the typed qualifier part.

The type of the selection tree, where qual1 is the typed qualifier part.

Attributes

Inherited from:
TypeAssigner
def seqToRepeated(tree: Tree)(using Context): Tree

Attributes

Inherited from:
TypeAssigner
def setDocstring(sym: Symbol, tree: Tree)(using Context): Unit

Attributes

Inherited from:
Namer
override def simplify(tree: Tree, pt: Type, locked: TypeVars)(using Context): tree.type

Interpolate and simplify the type of the given tree.

Interpolate and simplify the type of the given tree.

Attributes

Definition Classes
Inherited from:
Checker
def stripImplicit(tp: Type, wildcardOnly: Boolean)(using Context): Type

Drop any leading implicit parameter sections

Drop any leading implicit parameter sections

Attributes

Inherited from:
Applications
def stripInferrable(tp: Type)(using Context): Type

Drop any leading type or implicit parameter sections

Drop any leading type or implicit parameter sections

Attributes

Inherited from:
Applications
def superType(qualType: Type, mix: Ident, mixinClass: Symbol, pos: SrcPos)(using Context): ValueType

Attributes

Inherited from:
TypeAssigner
override def symbolOfTree(tree: Tree)(using Context): Symbol

The symbol of the given expanded tree.

The symbol of the given expanded tree.

Attributes

Definition Classes
Inherited from:
ReTyper
def toNotNullTermRef(tree: Tree, pt: Type)(using Context): Tree

If tree's type is a TermRef identified by flow typing to be non-null, then cast away trees nullability. Otherwise, tree remains unchanged.

If tree's type is a TermRef identified by flow typing to be non-null, then cast away trees nullability. Otherwise, tree remains unchanged.

Example: If x is a trackable reference and we know x is not null at this point, (x: T | Null) => x.$asInstanceOf$[x.type & T]

Attributes

Inherited from:
Typer
def trimParamss(t: Type, paramss: List[List[Symbol]])(using Context): (List[List[Symbol]], Int)

The largest suffix of paramss that has the same first parameter name as t, plus the number of term parameters in paramss that come before that suffix.

The largest suffix of paramss that has the same first parameter name as t, plus the number of term parameters in paramss that come before that suffix.

Attributes

Inherited from:
Applications
def tryAlternatively[T](op1: Context ?=> T)(op2: Context ?=> T)(using Context): T

Try op1, if there are errors, try op2, if op2 also causes errors, fall back to errors and result of op1.

Try op1, if there are errors, try op2, if op2 also causes errors, fall back to errors and result of op1.

Attributes

Inherited from:
Typer
def tryApplyingExtensionMethod(methodRef: TermRef, receiver: Tree)(using Context): Option[Tree]

Assuming methodRef is a reference to an extension method defined e.g. as

Assuming methodRef is a reference to an extension method defined e.g. as

extension [T1, T2](using A)(using B, C)(receiver: R)(using D) def foo[T3](using E)(f: F): G = ???

return the tree representing methodRef partially applied to the receiver and all the implicit parameters preceding it (A, B, C) with the type parameters of the extension (T1, T2) inferred. None is returned if the implicit search fails for any of the leading implicit parameters or if the receiver has a wrong type (note that in general the type of the receiver might depend on the exact types of the found instances of the proceeding implicits). No implicit search is tried for implicits following the receiver or for parameters of the def (D, E).

Attributes

Inherited from:
Applications
def tryEither[T](op: Context ?=> T)(fallBack: (T, TyperState) => T)(using Context): T

Attributes

Inherited from:
Typer
def tryExtensionOrConversion(tree: Select, pt: Type, mbrProto: Type, qual: Tree, locked: TypeVars, compat: Compatibility, inSelect: Boolean)(using Context): Tree

Given a selection qual.name, try to convert to an extension method application name(qual) or insert an implicit conversion c(qual).name.

Given a selection qual.name, try to convert to an extension method application name(qual) or insert an implicit conversion c(qual).name.

Attributes

Returns

The converted tree, or EmptyTree is not successful.

Inherited from:
Typer
override def tryInsertApplyOrImplicit(tree: Tree, pt: ProtoType, locked: TypeVars)(fallBack: => Tree)(using Context): Tree

Potentially add apply node or implicit conversions. Before trying either, if the function is applied to an empty parameter list (), we try

Potentially add apply node or implicit conversions. Before trying either, if the function is applied to an empty parameter list (), we try

0th strategy: If tree overrides a nullary method, mark the prototype so that the argument is dropped and return tree itself. (but do this at most once per tree).

After that, two strategies are tried, and the first that is successful is picked.

1st strategy: Try to insert .apply so that the result conforms to prototype pt. This strategy is not tried if the prototype represents already another .apply or .apply() selection.

2nd strategy: If tree is a select qual.name, try to insert an implicit conversion around the qualifier part qual so that the result conforms to the expected type with wildcard result type.

If neither of the strategies are successful, continues with the apply result if an apply insertion was tried and tree has an apply method, or continues with fallBack otherwise. fallBack is supposed to always give an error.

Attributes

Definition Classes
Inherited from:
ReTyper
def tryInsertImplicitOnQualifier(tree: Tree, pt: Type, locked: TypeVars)(using Context): Option[Tree]

If this tree is a select node qual.name (possibly applied to type variables) that does not conform to pt, try two mitigations:

If this tree is a select node qual.name (possibly applied to type variables) that does not conform to pt, try two mitigations:

  1. Instantiate any TypeVars in the widened type of tree with their lower bounds.
  2. Try to insert an implicit conversion c around qual so that c(qual).name conforms to pt.

Attributes

Inherited from:
Typer
def tryWithTypeTest(tree: Typed, pt: Type)(using Context): Tree

For a typed tree e: T, if T is an abstract type for which an implicit type test or class tag tt exists, rewrite to tt(e).

For a typed tree e: T, if T is an abstract type for which an implicit type test or class tag tt exists, rewrite to tt(e).

Attributes

Inherited from:
Typer
def typeOfNew(tpt: Tree)(using Context): Type

Normalize type T appearing in a new T by following eta expansions to avoid higher-kinded types.

Normalize type T appearing in a new T by following eta expansions to avoid higher-kinded types.

Attributes

Inherited from:
TypeAssigner
override def typed(tree: Tree, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typed(tree: Tree, pt: Type, locked: TypeVars)(using Context): Tree

Typecheck and adapt tree, returning a typed tree. Parameters as for typedUnadapted

Typecheck and adapt tree, returning a typed tree. Parameters as for typedUnadapted

Attributes

Inherited from:
Typer
def typedAhead(tree: Tree, typed: Tree => Tree)(using Context): Tree

Typecheck tree during completion using typed, and remember result in TypedAhead map

Typecheck tree during completion using typed, and remember result in TypedAhead map

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Namer
def typedAheadExpr(tree: Tree, pt: Type)(using Context): Tree

Attributes

Inherited from:
Namer
def typedAheadType(tree: Tree, pt: Type)(using Context): Tree

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Typer
def typedAnnotated(tree: Annotated, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedAnnotation(annot: Tree)(using Context): Tree

Attributes

Inherited from:
Typer
def typedAppliedSplice(tree: Apply, pt: Type)(using Context): Tree

Types a splice applied to some arguments $f(arg1, ..., argn) in a quote pattern.

Types a splice applied to some arguments $f(arg1, ..., argn) in a quote pattern.

The tree is desugared into $f.apply(arg1, ..., argn) where the expression $f is expected to type as a function type (T1, ..., Tn) => R. Ti is the type of the argument argi and R if the type of the prototype. The prototype must be fully defined to be able to infer the type of R.

Attributes

Inherited from:
QuotesAndSplices

Attributes

Inherited from:
Typer
override def typedApply(tree: Apply, pt: Type)(using Context): Tree

Typecheck application. Result could be an Apply node, or, if application is an operator assignment, also an Assign or Block node.

Typecheck application. Result could be an Apply node, or, if application is an operator assignment, also an Assign or Block node.

Attributes

Definition Classes
Inherited from:
Checker
override def typedAsFunction(tree: PostfixOp, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Typer
def typedAssign(tree: Assign, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
override def typedBind(tree: Bind, pt: Type)(using Context): Bind

Attributes

Definition Classes
Inherited from:
ReTyper
override def typedBlock(tree: Block, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedBlockStats(stats: List[Tree])(using Context): (List[Tree], Context)

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer
override def typedCase(tree: CaseDef, sel: Tree, selType: Type, pt: Type)(using Context): CaseDef

Type a case.

Type a case.

Attributes

Definition Classes
Inherited from:
Checker
def typedCases(cases: List[CaseDef], sel: Tree, wideSelType0: Type, pt: Type)(using Context): List[CaseDef]

Attributes

Inherited from:
Typer
override def typedClassDef(cdef: TypeDef, cls: ClassSymbol)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedClosure(tree: Closure, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedDefDef(ddef: DefDef, sym: Symbol)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedDependentMatchFinish(tree: Match, sel: Tree, wideSelType0: Type, cases: List[CaseDef], pt: MatchType)(using Context): Tree

Special typing of Match tree when the expected type is a MatchType, and the patterns of the Match tree and the MatchType correspond.

Special typing of Match tree when the expected type is a MatchType, and the patterns of the Match tree and the MatchType correspond.

Attributes

Inherited from:
Typer
def typedDynamicApply(tree: Apply, isInsertedApply: Boolean, pt: Type)(using Context): Tree

Translate selection that does not typecheck according to the normal rules into a applyDynamic/applyDynamicNamed. foo.bar(baz0, baz1, ...) ~~> foo.applyDynamic(bar)(baz0, baz1, ...) foo.bar[T0, ...](baz0, baz1, ...) ~~> foo.applyDynamicT0, ...(baz0, baz1, ...) foo.bar(x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed("bar")(("x", bazX), ("y", bazY), ("", baz), ...) foo.bar[T0, ...](x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamedT0, ...(("x", bazX), ("y", bazY), ("", baz), ...)

Translate selection that does not typecheck according to the normal rules into a applyDynamic/applyDynamicNamed. foo.bar(baz0, baz1, ...) ~~> foo.applyDynamic(bar)(baz0, baz1, ...) foo.bar[T0, ...](baz0, baz1, ...) ~~> foo.applyDynamicT0, ...(baz0, baz1, ...) foo.bar(x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamed("bar")(("x", bazX), ("y", bazY), ("", baz), ...) foo.bar[T0, ...](x = bazX, y = bazY, baz, ...) ~~> foo.applyDynamicNamedT0, ...(("x", bazX), ("y", bazY), ("", baz), ...)

Attributes

Inherited from:
Dynamic
def typedDynamicAssign(tree: Assign, pt: Type)(using Context): Tree

Translate selection that does not typecheck according to the normal rules into a updateDynamic. foo.bar = baz ~~> foo.updateDynamic(bar)(baz)

Translate selection that does not typecheck according to the normal rules into a updateDynamic. foo.bar = baz ~~> foo.updateDynamic(bar)(baz)

Attributes

Inherited from:
Dynamic
def typedDynamicSelect(tree: Select, targs: List[Tree], pt: Type)(using Context): Tree

Translate selection that does not typecheck according to the normal rules into a selectDynamic. foo.bar ~~> foo.selectDynamic(bar) foo.bar[T0, ...] ~~> foo.selectDynamicT0, ...

Translate selection that does not typecheck according to the normal rules into a selectDynamic. foo.bar ~~> foo.selectDynamic(bar) foo.bar[T0, ...] ~~> foo.selectDynamicT0, ...

Note: inner part of translation foo.bar(baz) = quux ~~> foo.selectDynamic(bar).update(baz, quux) is achieved through an existing transformation of in typedAssign [foo.bar(baz) = quux ~~> foo.bar.update(baz, quux)].

Attributes

Inherited from:
Dynamic
override def typedExport(exp: Export)(using Context): Export

Attributes

Definition Classes
Inherited from:
ReTyper
def typedExpr(tree: Tree, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedFunction(tree: Function, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedFunctionType(tree: Function, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedFunctionValue(tree: Function, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
override def typedHole(tree: Hole, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedIdent(tree: Ident, pt: Type)(using Context): Tree

Attribute an identifier consisting of a simple name or wildcard

Attribute an identifier consisting of a simple name or wildcard

Value parameters

tree

The tree representing the identifier. Transformations: (1) Prefix class members with this. (2) Change imported symbols to selections. (3) Change pattern Idents id (but not wildcards) to id @ _

Attributes

Definition Classes
Inherited from:
Checker
def typedIf(tree: If, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedImplicit(cand: Candidate, pt: Type, argument: Tree, span: Span)(using Context): SearchResult

Try to typecheck an implicit reference

Try to typecheck an implicit reference

Attributes

Inherited from:
Implicits
override def typedImport(tree: Import)(using Context): Tree

Attributes

Definition Classes
Inherited from:
ReTyper
def typedImportQualifier(imp: Import, typd: (Tree, Type) => Tree)(using Context): Tree

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer
def typedInfixOp(tree: InfixOp, pt: Type)(using Context): Tree

Translate infix operation expression l op r to

Translate infix operation expression l op r to

l.op(r) if op is left-associative { val x = l; r.op(x) } if op is right-associative call-by-value and l is impure, and not in a quote pattern r.op(l) if op is right-associative call-by-name, or l is pure, or in a quote pattern

Translate infix type l op r to op[l, r] Translate infix pattern l op r to op(l, r)

Attributes

Inherited from:
Typer
override def typedInlined(tree: Inlined, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedLabeled(tree: Labeled)(using Context): Labeled

Attributes

Definition Classes
Inherited from:
Checker

Attributes

Inherited from:
Typer
override def typedLiteral(tree: Literal)(implicit ctc: Context): Tree

Attributes

Definition Classes
Inherited from:
ReTyper
def typedMatch(tree: Match, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedMatchFinish(tree: Match, sel: Tree, wideSelType: Type, cases: List[CaseDef], pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer
def typedNamedArg(tree: NamedArg, pt: Type)(using Context): NamedArg

Attributes

Inherited from:
Typer
def typedNamedArgs(args: List[Tree])(using Context): List[NamedArg]

Attributes

Inherited from:
Applications
override def typedNew(tree: New, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedNumber(tree: Number, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
override def typedPackageDef(tree: PackageDef)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedPattern(tree: Tree, selType: Type)(using Context): Tree

Attributes

Inherited from:
Typer
def typedPolyFunction(tree: PolyFunction, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer
override def typedQuote(tree: Quote, pt: Type)(using Context): Tree

Translate '{ e } into scala.quoted.Expr.apply(e) and '[T] into scala.quoted.Type.apply[T] while tracking the quotation level in the context.

Translate '{ e } into scala.quoted.Expr.apply(e) and '[T] into scala.quoted.Type.apply[T] while tracking the quotation level in the context.

Attributes

Definition Classes
Inherited from:
Checker
override def typedQuotePattern(tree: QuotePattern, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedQuotedTypeVar(tree: Ident, pt: Type)(using Context): Tree

Type check a type binding reference in a quoted pattern.

Type check a type binding reference in a quoted pattern.

If no binding exists with that name, this becomes the definition of a new type binding.

Attributes

Inherited from:
QuotesAndSplices
override def typedRefinedTypeTree(tree: RefinedTypeTree)(using Context): TypTree

Attributes

Definition Classes
Inherited from:
ReTyper
override def typedReturn(tree: Return)(using Context): Return

Attributes

Definition Classes
Inherited from:
Checker
override def typedSelect(tree: Select, pt: Type)(using Context): Tree

Makes sure the symbol in the tree can be approximately reconstructed by calling member on the qualifier type. Approximately means: The two symbols might be different but one still overrides the other.

Makes sure the symbol in the tree can be approximately reconstructed by calling member on the qualifier type. Approximately means: The two symbols might be different but one still overrides the other.

Attributes

Definition Classes
Inherited from:
Checker
def typedSelect(tree0: Select, pt: Type, qual: Tree)(using Context): Tree

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer

Attributes

Inherited from:
Typer
override def typedSplice(tree: Splice, pt: Type)(using Context): Tree

Translate ${ t: Expr[T] } into expression t.splice while tracking the quotation level in the context

Translate ${ t: Expr[T] } into expression t.splice while tracking the quotation level in the context

Attributes

Definition Classes
Inherited from:
Checker
override def typedSplicePattern(tree: SplicePattern, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedStats(trees: List[Tree], exprOwner: Symbol)(using Context): (List[Tree], Context)

Check that all defined symbols have legal owners. An owner is legal if it is either the same as the context's owner or there's an owner chain of valdefs starting at the context's owner and reaching up to the symbol's owner. The reason for this relaxed matching is that we should be able to pull out an expression as an initializer of a helper value without having to do a change owner traversal of the expression.

Check that all defined symbols have legal owners. An owner is legal if it is either the same as the context's owner or there's an owner chain of valdefs starting at the context's owner and reaching up to the symbol's owner. The reason for this relaxed matching is that we should be able to pull out an expression as an initializer of a helper value without having to do a change owner traversal of the expression.

Attributes

Definition Classes
Inherited from:
Checker
override def typedSuper(tree: Super, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker

Attributes

Inherited from:
Typer
override def typedThis(tree: This)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def typedThrow(tree: Throw)(using Context): Tree

Attributes

Inherited from:
Typer
def typedTrees(trees: List[Tree])(using Context): List[Tree]

Attributes

Inherited from:
Typer
def typedTry(tree: ParsedTry, pt: Type)(using Context): Try

Attributes

Inherited from:
Typer
def typedTry(tree: Try, pt: Type)(using Context): Try

Attributes

Inherited from:
Typer
def typedTuple(tree: Tuple, pt: Type)(using Context): Tree

Translate tuples of all arities

Translate tuples of all arities

Attributes

Inherited from:
Typer
def typedType(tree: Tree, pt: Type, mapPatternBounds: Boolean)(using Context): Tree

Attributes

Inherited from:
Typer
def typedTypeApply(tree: TypeApply, pt: Type)(using Context): Tree

Attributes

Inherited from:
Applications

Attributes

Inherited from:
Typer
def typedTypeCase(cdef: CaseDef, selType: Type, pt: Type)(using Context): CaseDef

Type a case of a type match

Type a case of a type match

Attributes

Inherited from:
Typer
override def typedTypeDef(tdef: TypeDef, sym: Symbol)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedTypeTree(tree: TypeTree, pt: Type)(using Context): TypeTree

Attributes

Definition Classes
Inherited from:
ReTyper
override def typedTyped(tree: Typed, pt: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker

Attributes

Inherited from:
Typer
override def typedUnApply(tree: Apply, selType: Type)(using Context): Tree

Attributes

Definition Classes
Inherited from:
ReTyper
override def typedUnApply(tree: UnApply, selType: Type)(using Context): UnApply

A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.

A typed unapply hook, can be overridden by re any-typers between frontend and pattern matcher.

Attributes

Definition Classes
Inherited from:
ReTyper
override def typedUnadapted(tree: Tree, pt: Type, locked: TypeVars)(using Context): Tree

Typecheck tree without adapting it, returning a typed tree.

Typecheck tree without adapting it, returning a typed tree.

Value parameters

initTree

the untyped tree

locked

the set of type variables of the current typer state that cannot be interpolated at the present time

pt

the expected result type

Attributes

Definition Classes
Inherited from:
Checker
def typedUnadapted(initTree: Tree, pt: Type)(using Context): Tree

Attributes

Inherited from:
Typer
override def typedValDef(vdef: ValDef, sym: Symbol)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
override def typedWhileDo(tree: WhileDo)(using Context): Tree

Attributes

Definition Classes
Inherited from:
Checker
def valOrDefDefSig(mdef: ValOrDefDef, sym: Symbol, paramss: List[List[Symbol]], paramFn: Type => Type)(using Context): Type

The type signature of a ValDef or DefDef

The type signature of a ValDef or DefDef

Value parameters

mdef

The definition

paramFn

A wrapping function that produces the type of the defined symbol, given its final return type

sym

Its symbol

Attributes

Inherited from:
Namer
override def viewExists(from: Type, to: Type)(using Context): Boolean

Attributes

Definition Classes
Inherited from:
Implicits
override def widenEnumCase(tree: Tree, pt: Type)(using Context): Tree

If tree is a complete application of a compiler-generated apply or copy method of an enum case, widen its type to the underlying type by means of a type ascription, as long as the widened type is still compatible with the expected type. The underlying type is the intersection of all class parents of the original type.

If tree is a complete application of a compiler-generated apply or copy method of an enum case, widen its type to the underlying type by means of a type ascription, as long as the widened type is still compatible with the expected type. The underlying type is the intersection of all class parents of the original type.

Attributes

Definition Classes
Inherited from:
ReTyper
def withDefinedSyms[T](trees: List[Tree])(op: => T)(using Context): T

Attributes

Inherited from:
Checker
def withPatSyms[T](syms: List[Symbol])(op: => T)(using Context): T

The following invariant holds:

The following invariant holds:

patBoundSyms.contains(sym) <=> sym.isPatternBound

Attributes

Inherited from:
Checker

Inherited fields

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Namer
inline val MaxSuggestions: 10

The maximal number of suggested imports to make

The maximal number of suggested imports to make

Attributes

Inherited from:
ImportSuggestions

Attributes

Inherited from:
Namer

Attributes

Inherited from:
Namer

A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versions of the four maps above including this one, so that trees that are shared between different DefDefs can be independently used as indices. It also contains a scope that contains nested parameters.

A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versions of the four maps above including this one, so that trees that are shared between different DefDefs can be independently used as indices. It also contains a scope that contains nested parameters.

Attributes

Inherited from:
Namer
var nestingBlock: Block | Null

Attributes

Inherited from:
Checker

The scope of the typer. For nested typers (cf Namer#nestedTyper), this is a place parameters are entered during completion and where they survive until typechecking. A context with this typer also has this scope.

The scope of the typer. For nested typers (cf Namer#nestedTyper), this is a place parameters are entered during completion and where they survive until typechecking. A context with this typer also has this scope.

Attributes

Inherited from:
Typer

Extensions

Inherited extensions

extension (refs: List[(TermRef, String)])

The ref parts of this list of pairs, discarding subsequent elements that have the same String part. Elements are sorted by their String parts.

The ref parts of this list of pairs, discarding subsequent elements that have the same String part. Elements are sorted by their String parts.

Attributes

Inherited from:
ImportSuggestions
extension (refs: List[TermRef])
def best(n: Int)(using Context): List[TermRef]

The best n references in refs, according to compare compare is a partial order. If there's a tie, we take elements in the order thy appear in the list.

The best n references in refs, according to compare compare is a partial order. If there's a tie, we take elements in the order thy appear in the list.

Attributes

Inherited from:
ImportSuggestions