Class

scala.tools.nsc.typechecker.Typers

Typer

Related Doc: package Typers

Permalink

abstract class Typer extends Analyzer.TyperDiagnostics with Analyzer.Adaptation with Analyzer.Tag with Analyzer.PatternTyper with Analyzer.TyperContextErrors

Source
Typers.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Typer
  2. TyperContextErrors
  3. PatternTyper
  4. Tag
  5. Adaptation
  6. TyperDiagnostics
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Typer(context0: Analyzer.Context)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink

    Test two objects for inequality.

    Test two objects for inequality.

    returns

    true if !(this == that), false otherwise.

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink

    Equivalent to x.hashCode except for boxed numeric types and null.

    Equivalent to x.hashCode except for boxed numeric types and null. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to any2stringadd[Analyzer.Typer] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Analyzer.Typer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to ArrowAssoc[Analyzer.Typer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  6. object TyperErrorGen

    Permalink
    Definition Classes
    TyperContextErrors
  7. def adapt(tree: Global.Tree, mode: Mode, pt: Global.Type, original: Global.Tree = EmptyTree): Global.Tree

    Permalink

    Perform the following adaptations of expression, pattern or type tree wrt to given mode mode and given prototype pt: (-1) For expressions with annotated types, let AnnotationCheckers decide what to do (0) Convert expressions with constant types to literals (unless in interactive/scaladoc mode) (1) Resolve overloading, unless mode contains FUNmode (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.

    Perform the following adaptations of expression, pattern or type tree wrt to given mode mode and given prototype pt: (-1) For expressions with annotated types, let AnnotationCheckers decide what to do (0) Convert expressions with constant types to literals (unless in interactive/scaladoc mode) (1) Resolve overloading, unless mode contains FUNmode (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

    Attributes
    protected
  8. def adaptAfterOverloadResolution(tree: Global.Tree, mode: Mode, pt: Global.Type = WildcardType, original: Global.Tree = EmptyTree): Global.Tree

    Permalink
  9. def adaptCase(cdef: Global.CaseDef, mode: Mode, tpe: Global.Type): Global.CaseDef

    Permalink
  10. def adaptToArguments(qual: Global.Tree, name: Global.Name, args: List[Global.Tree], pt: Global.Type, reportAmbiguous: Boolean, saveErrors: Boolean): Global.Tree

    Permalink

    Try to apply an implicit conversion to qual to that it contains a method name which can be applied to arguments args with expected type pt.

    Try to apply an implicit conversion to qual to that it contains a method name which can be applied to arguments args with expected type pt. If pt is defined, there is a fallback to try again with pt = ?. This helps avoiding propagating result information too far and solves #1756. If no conversion is found, return qual unchanged.

  11. def adaptToMember(qual: Global.Tree, searchTemplate: Global.Type, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Global.Tree

    Permalink
  12. def adaptToMemberWithArgs(tree: Global.Tree, qual: Global.Tree, name: Global.Name, mode: Mode, reportAmbiguous: Boolean, saveErrors: Boolean): Global.Tree

    Permalink

    Try to apply an implicit conversion to qual so that it contains a method name.

    Try to apply an implicit conversion to qual so that it contains a method name. If that's ambiguous try taking arguments into account using adaptToArguments.

  13. def adaptToName(qual: Global.Tree, name: Global.Name): Global.Tree

    Permalink

    Try to apply an implicit conversion to qual to that it contains a member name of arbitrary type.

    Try to apply an implicit conversion to qual to that it contains a member name of arbitrary type. If no conversion is found, return qual unchanged.

  14. def applyImplicitArgs(fun: Global.Tree): Global.Tree

    Permalink

    Find implicit arguments and pass them to given tree.

  15. final def asInstanceOf[T0]: T0

    Permalink

    Cast the receiver object to be of type T0.

    Cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expression List(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

    the receiver object.

    Definition Classes
    Any
    Exceptions thrown

    ClassCastException if the receiver object is not an instance of the erasure of type T0.

  16. def atOwner(tree: Global.Tree, owner: Global.Symbol): Analyzer.Typer

    Permalink
  17. def atOwner(owner: Global.Symbol): Analyzer.Typer

    Permalink
  18. def callToCompanionConstr(context: Analyzer.Context, calledFun: Global.Symbol): Boolean

    Permalink
  19. def canAdaptConstantTypeToLiteral: Boolean

    Permalink

    Overridden to false in scaladoc and/or interactive.

  20. def canTranslateEmptyListToNil: Boolean

    Permalink
  21. def checkClassType(tpt: Global.Tree): Boolean

    Permalink

    Check that tpt refers to a non-refinement class type

  22. object checkDead

    Permalink
    Definition Classes
    TyperDiagnostics
  23. def checkExistentialsFeature(pos: Global.Position, tpe: Global.Type, prefix: String): AnyVal

    Permalink
  24. def checkFeature(pos: Global.Position, featureTrait: Global.Symbol, construct: ⇒ String = "", immediate: Boolean = false): Boolean

    Permalink

    Check whether feature given by featureTrait is enabled.

    Check whether feature given by featureTrait is enabled. If it is not, issue an error or a warning depending on whether the feature is required.

    construct

    A string expression that is substituted for "#" in the feature description string

    immediate

    When set, feature check is run immediately, otherwise it is run at the end of the typechecking run for the enclosing unit. This is done to avoid potential cyclic reference errors by implicits that are forced too early.

    returns

    if feature check is run immediately: true if feature is enabled, false otherwise if feature check is delayed or suppressed because we are past typer: true

  25. def checkFinitary(classinfo: Global.ClassInfoType): Unit

    Permalink
  26. def checkMethodStructuralCompatible(ddef: Global.DefDef): Unit

    Permalink

    Check if a structurally defined method violates implementation restrictions.

    Check if a structurally defined method violates implementation restrictions. A method cannot be called if it is a non-private member of a refinement type and if its parameter's types are any of:

    • the self-type of the refinement
    • a type member of the refinement
    • an abstract type declared outside of the refinement.
    • an instance of a value class Furthermore, the result type may not be a value class either
  27. object checkNoEscaping extends Global.TypeMap

    Permalink

    Check that type of given tree does not contain local or private components.

  28. def checkNonCyclic(defn: Global.Tree, tpt: Global.Tree): Unit

    Permalink
  29. def checkNonCyclic(sym: Global.Symbol): Unit

    Permalink
  30. def checkNonCyclic(pos: Global.Position, tp: Global.Type, lockedSym: Global.Symbol): Boolean

    Permalink
  31. def checkNonCyclic(pos: Global.Position, tp: Global.Type): Boolean

    Permalink

    Check that type tp is not a subtype of itself.

  32. def checkParamsConvertible(tree: Global.Tree, tpe0: Global.Type): Unit

    Permalink
  33. def checkStablePrefixClassType(tpt: Global.Tree): Boolean

    Permalink

    Check that tpt refers to a class type with a stable prefix.

  34. object checkUnused

    Permalink
    Definition Classes
    TyperDiagnostics
  35. def checkValidAdaptation(t: Global.Tree, args: List[Global.Tree]): Boolean

    Permalink
    Definition Classes
    Adaptation
  36. def clone(): AnyRef

    Permalink

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
    Note

    not specified by SLS as a member of AnyRef

  37. def computeMacroDefType(ddef: Global.DefDef, pt: Global.Type): Global.Type

    Permalink
  38. def computeParamAliases(clazz: Global.Symbol, vparamss: List[List[Global.ValDef]], rhs: Global.Tree): Unit

    Permalink

    Enter all aliases of local parameter accessors.

  39. def computeType(tree: Global.Tree, pt: Global.Type): Global.Type

    Permalink
  40. final def constrTyperIf(inConstr: Boolean): Analyzer.Typer

    Permalink

    The typer for an expression, depending on where we are.

    The typer for an expression, depending on where we are. If we are before a superclass call, this is a typer over a constructor context; otherwise it is the current typer.

  41. var context: Analyzer.Context

    Permalink
  42. def context1: Analyzer.Context

    Permalink
  43. def cyclicReferenceMessage(sym: Global.Symbol, tree: Global.Tree): Option[String]

    Permalink

    Returns Some(msg) if the given tree is untyped apparently due to a cyclic reference, and None otherwise.

    Returns Some(msg) if the given tree is untyped apparently due to a cyclic reference, and None otherwise.

    Definition Classes
    TyperDiagnostics
  44. def doTypedApply(tree: Global.Tree, fun0: Global.Tree, args: List[Global.Tree], mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  45. def doTypedUnapply(tree: Global.Tree, fun0: Global.Tree, fun: Global.Tree, args: List[Global.Tree], mode: Mode, pt: Global.Type): Global.Tree

    Permalink
    Definition Classes
    PatternTyper
  46. def dropExistential(tp: Global.Type): Global.Type

    Permalink
  47. object dyna

    Permalink
  48. def ensuring(cond: (Analyzer.Typer) ⇒ Boolean, msg: ⇒ Any): Analyzer.Typer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to Ensuring[Analyzer.Typer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  49. def ensuring(cond: (Analyzer.Typer) ⇒ Boolean): Analyzer.Typer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to Ensuring[Analyzer.Typer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  50. def ensuring(cond: Boolean, msg: ⇒ Any): Analyzer.Typer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to Ensuring[Analyzer.Typer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  51. def ensuring(cond: Boolean): Analyzer.Typer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to Ensuring[Analyzer.Typer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  52. def enterSym(txt: Analyzer.Context, tree: Global.Tree): Analyzer.Context

    Permalink
    Attributes
    protected
  53. def enterSyms(txt: Analyzer.Context, trees: List[Global.Tree]): Unit

    Permalink
    Attributes
    protected
  54. final def eq(arg0: AnyRef): Boolean

    Permalink

    Tests whether the argument (that) is a reference to the receiver object (this).

    Tests whether the argument (that) is a reference to the receiver object (this).

    The eq method implements an equivalence relation on non-null instances of AnyRef, and has three additional properties:

    • It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false.
    • For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.
    • null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  55. def equals(arg0: Any): Boolean

    Permalink

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to eq.

    See also equals in scala.Any.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  56. def extractorForUncheckedType(pos: Global.Position, pt: Global.Type): Global.Tree

    Permalink
    Definition Classes
    PatternTyper
  57. def finalize(): Unit

    Permalink

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the finalize method is invoked, as well as the interaction between finalize and non-local returns and exceptions, are all platform dependent.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
    Note

    not specified by SLS as a member of AnyRef

  58. def finishMethodSynthesis(templ: Global.Template, clazz: Global.Symbol, context: Analyzer.Context): Global.Template

    Permalink

    In order to override this in the TreeCheckers Typer so synthetics aren't re-added all the time, it is exposed here the module/class typing methods go through it.

    In order to override this in the TreeCheckers Typer so synthetics aren't re-added all the time, it is exposed here the module/class typing methods go through it. ...but it turns out it's also the ideal spot for namer/typer coordination for the tricky method synthesis scenarios, so we'll make it that.

    Attributes
    protected
  59. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to StringFormat[Analyzer.Typer] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  60. final def getClass(): Class[_]

    Permalink

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
    AnyRef → Any
    Note

    not specified by SLS as a member of AnyRef

  61. def hashCode(): Int

    Permalink

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in scala.Any.

    returns

    the hash code value for this object.

    Definition Classes
    AnyRef → Any
  62. val infer: Analyzer.Inferencer

    Permalink
  63. def inferView(tree: Global.Tree, from: Global.Type, to: Global.Type, reportAmbiguous: Boolean, saveErrors: Boolean): Global.Tree

    Permalink

    Infer an implicit conversion (view) between two types.

    Infer an implicit conversion (view) between two types.

    tree

    The tree which needs to be converted.

    from

    The source type of the conversion

    to

    The target type of the conversion

    reportAmbiguous

    Should ambiguous implicit errors be reported? False iff we search for a view to find out whether one type is coercible to another.

    saveErrors

    Should ambiguous and divergent implicit errors that were buffered during the inference of a view be put into the original buffer. False iff we don't care about them.

  64. def inferView(tree: Global.Tree, from: Global.Type, to: Global.Type, reportAmbiguous: Boolean): Global.Tree

    Permalink
  65. def instantiate(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  66. def instantiateExpectingUnit(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink

    If the expected type is Unit: try instantiating type arguments with expected type Unit, but if that fails, try again with pt = WildcardType and discard the expression.

  67. def instantiatePossiblyExpectingUnit(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  68. def isCapturedExistential(sym: Global.Symbol): Boolean

    Permalink
  69. final def isInstanceOf[T0]: Boolean

    Permalink

    Test whether the dynamic type of the receiver object is T0.

    Test whether the dynamic type of the receiver object is T0.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression 1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    Definition Classes
    Any
  70. def isNamedApplyBlock(tree: Global.Tree): Boolean

    Permalink

    Is tree a block created by a named application?

  71. def isReferencedFrom(ctx: Analyzer.Context, sym: Global.Symbol): Boolean

    Permalink
  72. def isStale(sym: Global.Symbol): Boolean

    Permalink

    A symbol is stale if it is toplevel, to be loaded from a classfile, and the classfile is produced from a sourcefile which is compiled in the current run.

  73. def labelTyper(ldef: Global.LabelDef): Analyzer.Typer

    Permalink

    The typer for a label definition.

    The typer for a label definition. If this is part of a template we first have to enter the label definition.

  74. def macroImplementationNotFoundMessage(name: Global.Name): String

    Permalink

    This file will be the death of me.

    This file will be the death of me.

    Attributes
    protected
    Definition Classes
    TyperContextErrors
  75. def member(qual: Global.Tree, name: Global.Name): Global.Symbol

    Permalink

    The member with given name of given qualifier tree

  76. def missingSelectErrorTree(tree: Global.Tree, qual: Global.Tree, name: Global.Name): Global.Tree

    Permalink
  77. def namer: Analyzer.Namer

    Permalink
  78. final def ne(arg0: AnyRef): Boolean

    Permalink

    Equivalent to !(this eq that).

    Equivalent to !(this eq that).

    returns

    true if the argument is not a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  79. def needsInstantiation(tparams: List[Global.Symbol], formals: List[Global.Type], args: List[Global.Tree]): Boolean

    Permalink

    Does function need to be instantiated, because a missing parameter in an argument closure overlaps with an uninstantiated formal?

  80. final def notify(): Unit

    Permalink

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  81. final def notifyAll(): Unit

    Permalink

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  82. def packCaptured(tpe: Global.Type): Global.Type

    Permalink
  83. def packSymbols(hidden: List[Global.Symbol], tp: Global.Type): Global.Type

    Permalink

    Compute an existential type from raw hidden symbols syms and type tp

  84. def packedType(tree: Global.Tree, owner: Global.Symbol): Global.Type

    Permalink

    convert local symbols and skolems to existentials

  85. def packedTypes(trees: List[Global.Tree]): List[Global.Type]

    Permalink
  86. def permanentlyHiddenWarning(pos: Global.Position, hidden: Global.Name, defn: Global.Symbol): Unit

    Permalink
    Definition Classes
    TyperDiagnostics
  87. def qualifyingClass(tree: Global.Tree, qual: Global.Name, packageOK: Boolean): Global.Symbol

    Permalink

    The qualifying class of a this or super with prefix qual.

    The qualifying class of a this or super with prefix qual. packageOk is equal false when qualifying class symbol

  88. def reallyExists(sym: Global.Symbol): Boolean

    Permalink

    Is symbol defined and not stale?

  89. def reenterTypeParams(tparams: List[Global.TypeDef]): List[Global.Symbol]

    Permalink
  90. def reenterValueParams(vparamss: List[List[Global.ValDef]]): Unit

    Permalink
  91. def reportTypeError(context0: Analyzer.Context, pos: Global.Position, ex: Global.TypeError): Unit

    Permalink

    Report a type error.

    Report a type error.

    pos

    The position where to report the error

    ex

    The exception that caused the error

    Definition Classes
    TyperDiagnostics
  92. def resolveClassTag(pos: Global.Position, tp: Global.Type, allowMaterialization: Boolean = true): Global.Tree

    Permalink

    Finds in scope or materializes a ClassTag.

    Finds in scope or materializes a ClassTag. Should be used instead of ClassManifest every time compiler needs to persist an erasure.

    Once upon a time, we had an ErasureTag which was to ClassTag the same that WeakTypeTag is for TypeTag. However we found out that we don't really need this concept, so it got removed.

    pos

    Position for error reporting. Please, provide meaningful value.

    tp

    Type we're looking a ClassTag for, e.g. resolveClassTag(pos, IntTpe) will look for ClassTag[Int].

    allowMaterialization

    If true (default) then the resolver is allowed to launch materialization macros when there's no class tag in scope. If false then materialization macros are prohibited from running.

    returns

    Tree that represents an scala.reflect.ClassTag for tp if everything is okay. EmptyTree if the result contains unresolved (i.e. not spliced) type parameters and abstract type members. EmptyTree if allowMaterialization is false, and there is no class tag in scope.

    Definition Classes
    Tag
  93. def resolveTypeTag(pos: Global.Position, pre: Global.Type, tp: Global.Type, concrete: Boolean, allowMaterialization: Boolean = true): Global.Tree

    Permalink

    Finds in scope or materializes an WeakTypeTag (if concrete is false) or a TypeTag (if concrete is true).

    Finds in scope or materializes an WeakTypeTag (if concrete is false) or a TypeTag (if concrete is true).

    pos

    Position for error reporting. Please, provide meaningful value.

    pre

    Prefix that represents a universe this type tag will be bound to. If pre is set to NoType, then any type tag in scope will do, regardless of its affiliation. If pre is set to NoType, and tag resolution involves materialization, then mkRuntimeUniverseRef will be used.

    tp

    Type we're looking a TypeTag for, e.g. resolveTypeTag(pos, mkRuntimeUniverseRef, IntTpe, false) will look for scala.reflect.runtime.universe.TypeTag[Int].

    concrete

    If true then the result must not contain unresolved (i.e. not spliced) type parameters and abstract type members. If false then the function will always succeed (abstract types will be reified as free types).

    allowMaterialization

    If true (default) then the resolver is allowed to launch materialization macros when there's no type tag in scope. If false then materialization macros are prohibited from running.

    returns

    Tree that represents a scala.reflect.TypeTag for tp if everything is okay. EmptyTree if concrete is true and the result contains unresolved (i.e. not spliced) type parameters and abstract type members. EmptyTree if allowMaterialization is false, and there is no array tag in scope.

    Definition Classes
    Tag
  94. def rewrappingWrapperTrees(f: (Global.Tree) ⇒ List[Global.Tree]): (Global.Tree) ⇒ List[Global.Tree]

    Permalink

    For flatMapping a list of trees when you want the DocDefs and Annotated to be transparent.

  95. val runDefinitions: reflect.internal.Definitions.definitions.RunDefinitions

    Permalink
  96. def samToFunctionType(tp: Global.Type, sam: Global.Symbol = NoSymbol): Global.Type

    Permalink

    Convert a SAM type to the corresponding FunctionType, extrapolating BoundedWildcardTypes in the process (no type precision is lost by the extrapolation, but this facilitates dealing with the types arising from Java's use-site variance).

  97. def silent[T](op: (Analyzer.Typer) ⇒ T, reportAmbiguousErrors: Boolean = context.ambiguousErrors, newtree: Global.Tree = context.tree): Analyzer.SilentResult[T]

    Permalink
  98. def stabilize(tree: Global.Tree, pre: Global.Type, mode: Mode, pt: Global.Type): Global.Tree

    Permalink

    Post-process an identifier or selection node, performing the following:

    Post-process an identifier or selection node, performing the following:

    1. Check that non-function pattern expressions are stable (ignoring volatility concerns -- SI-6815) (and narrow the type of modules: a module reference in a pattern has type Foo.type, not "object Foo") 2. Check that packages and static modules are not used as values 3. Turn tree type into stable type if possible and required by context. 4. Give getClass calls a more precise type based on the type of the target of the call.
    Attributes
    protected
  99. def stabilizeFun(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  100. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  101. def synthesizePartialFunction(paramName: Global.TermName, paramPos: Global.Position, paramSynthetic: Boolean, tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink

    synthesize and type check a PartialFunction implementation based on the match in tree

    synthesize and type check a PartialFunction implementation based on the match in tree

    param => sel match { cases } becomes:

    new AbstractPartialFunction[$argTp, $matchResTp] { def applyOrElse[A1 <: $argTp, B1 >: $matchResTp]($param: A1, default: A1 => B1): B1 = $selector match { $cases } def isDefinedAt(x: $argTp): Boolean = $selector match { $casesTrue } }

    TODO: it would be nicer to generate the tree specified above at once and type it as a whole, there are two gotchas:

    • matchResTp may not be known until we've typed the match (can only use resTp when it's fully defined),
      • if we typed the match in isolation first, you'd know its result type, but would have to re-jig the owner structure
      • could we use a type variable for matchResTp and backpatch it?
    • occurrences of this in cases or sel must resolve to the this of the class originally enclosing the match, not of the anonymous partial function subclass

    an alternative TODO: add partial function AST node or equivalent and get rid of this synthesis --> do everything in uncurry (or later) however, note that pattern matching codegen is designed to run *before* uncurry

  102. def synthesizeSAMFunction(sam: Global.Symbol, fun: Global.Function, resPt: Global.Type, samClassTp: Global.Type, mode: Mode): Global.Tree

    Permalink

    Synthesize and type check the implementation of a type with a Single Abstract Method

    Synthesize and type check the implementation of a type with a Single Abstract Method

    { (p1: T1, ..., pN: TN) => body } : S

    expands to (where S is the expected type that defines a single abstract method named apply)

    { def apply$body(p1: T1, ..., pN: TN): T = body new S { def apply(p1: T1', ..., pN: TN'): T' = apply$body(p1,..., pN) } }

    If 'T' is not fully defined, it is inferred by type checking apply$body without a result type before type checking the block. The method's inferred result type is used instead of T. [See test/files/pos/sammy_poly.scala]

    The apply method is identified by the argument sam; S corresponds to the argument samClassTp, and resPt is derived from samClassTp -- it may be fully defined, or not... If it is not fully defined, we derive samClassTpFullyDefined by inferring any unknown type parameters.

    The types T1' ... TN' and T' are derived from the method signature of the sam method, as seen from the fully defined samClassTpFullyDefined.

    The function's body is put in a method outside of the class definition to enforce scoping. S's members should not be in scope in body.

    The restriction on implicit arguments (neither S's constructor, nor sam may take an implicit argument list), is largely to keep the implementation of type inference (the computation of samClassTpFullyDefined) simple.

    NOTE: it would be nicer to not have to type check apply$body separately when T is not fully defined. However T must be fully defined before we type the instantiation, as it'll end up as a parent type, which must be fully defined. Would be nice to have some kind of mechanism to insert type vars in a block of code, and have the instantiation of the first occurrence propagate to the rest of the block.

    TODO: by-name params scala> trait LazySink { def accept(a: => Any): Unit } defined trait LazySink

    scala> val f: LazySink = (a) => (a, a) f: LazySink = $anonfun$1@1fb26910

    scala> f(println("!")) <console>:10: error: LazySink does not take parameters f(println("!")) ^

    scala> f.accept(println("!")) ! !

  103. def toString(): String

    Permalink

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    AnyRef → Any
  104. def transformedOr(tree: Global.Tree, op: ⇒ Global.Tree): Global.Tree

    Permalink
  105. def transformedOrTyped(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  106. def typed(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink
  107. def typed(tree: Global.Tree, pt: Global.Type): Global.Tree

    Permalink

    Types expression tree with given prototype pt.

  108. def typed(tree: Global.Tree): Global.Tree

    Permalink

    Types expression or definition tree.

  109. def typed(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  110. def typed1(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  111. def typedAnnotation(ann: Global.Tree, mode: Mode = EXPRmode): Global.AnnotationInfo

    Permalink

    Convert an annotation constructor call into an AnnotationInfo.

  112. def typedArg(arg: Global.Tree, mode: Mode, newmode: Mode, pt: Global.Type): Global.Tree

    Permalink
  113. def typedArgs(args: List[Global.Tree], mode: Mode): collection.immutable.List[Global.Tree]

    Permalink
  114. def typedArgsForFormals(args: List[Global.Tree], formals: List[Global.Type], mode: Mode): List[Global.Tree]

    Permalink
    Definition Classes
    PatternTyper
  115. def typedBlock(block0: Global.Block, mode: Mode, pt: Global.Type): Global.Block

    Permalink
  116. def typedByValueExpr(tree: Global.Tree, pt: Global.Type = WildcardType): Global.Tree

    Permalink
  117. def typedCase(cdef: Global.CaseDef, pattpe: Global.Type, pt: Global.Type): Global.CaseDef

    Permalink
  118. def typedCases(cases: List[Global.CaseDef], pattp: Global.Type, pt: Global.Type): List[Global.CaseDef]

    Permalink
  119. def typedClassDef(cdef: Global.ClassDef): Global.Tree

    Permalink
  120. def typedClassOf(tree: Global.Tree, tpt: Global.Tree, noGen: Boolean = false): Global.Tree

    Permalink
  121. def typedConstructorPattern(fun0: Global.Tree, pt: Global.Type): Global.Tree

    Permalink
    Definition Classes
    PatternTyper
  122. def typedDefDef(ddef: Global.DefDef): Global.DefDef

    Permalink
  123. def typedDocDef(docDef: Global.DocDef, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  124. def typedExistentialTypeTree(tree: Global.ExistentialTypeTree, mode: Mode): Global.Tree

    Permalink
    Attributes
    protected
  125. def typedHigherKindedType(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink
  126. def typedHigherKindedType(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink

    Types a higher-kinded type tree -- pt denotes the expected kind and must be one of Kind.WildCard and Kind.FromParams

  127. def typedImport(imp: Global.Import): Global.Import

    Permalink
  128. def typedInPattern(tree: Global.Typed, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
    Attributes
    protected
    Definition Classes
    PatternTyper
  129. def typedLabelDef(ldef: Global.LabelDef): Global.LabelDef

    Permalink
  130. def typedMatch(selector: Global.Tree, cases: List[Global.CaseDef], mode: Mode, pt: Global.Type, tree: Global.Tree = EmptyTree): Global.Match

    Permalink
  131. def typedModifiers(mods: Global.Modifiers): Global.Modifiers

    Permalink

    Remove definition annotations from modifiers (they have been saved into the symbol's annotations in the type completer / namer)

    Remove definition annotations from modifiers (they have been saved into the symbol's annotations in the type completer / namer)

    However reification does need annotation definitions to proceed. Unfortunately, AnnotationInfo doesn't provide enough info to reify it in general case. The biggest problem is with the "atp: Type" field, which cannot be reified in some situations that involve locally defined annotations. See more about that in Reifiers.scala.

    That's why the original tree gets saved into original field of AnnotationInfo (happens elsewhere). The field doesn't get pickled/unpickled and exists only during a single compilation run. This simultaneously allows us to reify annotations and to preserve backward compatibility.

  132. def typedModuleDef(mdef: Global.ModuleDef): Global.Tree

    Permalink
  133. def typedOperator(tree: Global.Tree): Global.Tree

    Permalink

    Types function part of an application

  134. def typedParentTypes(templ: Global.Template): List[Global.Tree]

    Permalink
  135. def typedPattern(tree: Global.Tree, pt: Global.Type): Global.Tree

    Permalink

    Types a pattern with prototype pt

  136. def typedPos(pos: Global.Position)(tree: Global.Tree): Global.Tree

    Permalink
  137. def typedPos(pos: Global.Position, mode: Mode, pt: Global.Type)(tree: Global.Tree): Global.Tree

    Permalink
  138. def typedQualifier(tree: Global.Tree): Global.Tree

    Permalink
  139. def typedQualifier(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink

    Types qualifier tree of a select node.

    Types qualifier tree of a select node. E.g. is tree occurs in a context like tree.m.

  140. def typedQualifier(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink

    Types qualifier tree of a select node.

    Types qualifier tree of a select node. E.g. is tree occurs in a context like tree.m.

  141. def typedRefinement(templ: Global.Template): Unit

    Permalink
  142. def typedStarInPattern(tree: Global.Tree, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
    Attributes
    protected
    Definition Classes
    PatternTyper
  143. def typedStats(stats: List[Global.Tree], exprOwner: Global.Symbol): List[Global.Tree]

    Permalink
  144. def typedTemplate(templ0: Global.Template, parents1: List[Global.Tree]): Global.Template

    Permalink

    Check that inner classes do not inherit from Annotation

  145. def typedType(tree: Global.Tree): Global.Tree

    Permalink

    Types a (fully parameterized) type tree

  146. def typedType(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink

    Types a (fully parameterized) type tree

  147. def typedTypeApply(tree: Global.Tree, mode: Mode, fun: Global.Tree, args: List[Global.Tree]): Global.Tree

    Permalink
    Attributes
    protected
  148. def typedTypeConstructor(tree: Global.Tree): Global.Tree

    Permalink
  149. def typedTypeConstructor(tree: Global.Tree, mode: Mode): Global.Tree

    Permalink

    Types a type constructor tree used in a new or supertype

  150. def typedTypeDef(tdef: Global.TypeDef): Global.TypeDef

    Permalink
  151. def typedValDef(vdef: Global.ValDef): Global.ValDef

    Permalink
  152. final def typerWithCondLocalContext[T](c: ⇒ Analyzer.Context)(cond: Boolean)(f: (Analyzer.Typer) ⇒ T): T

    Permalink
    Annotations
    @inline()
  153. final def typerWithLocalContext[T](c: Analyzer.Context)(f: (Analyzer.Typer) ⇒ T): T

    Permalink
    Annotations
    @inline()
  154. def validateParentClasses(parents: List[Global.Tree], selfType: Global.Type): Unit

    Permalink

    Check that

    Check that

    • all parents are class types,
    • first parent class is not a mixin; following classes are mixins,
    • final classes are not inherited,

    - sealed classes are only inherited by classes which are nested within definition of base class, or that occur within same statement sequence,

    • self-type of current class is a subtype of self-type of each parent class.
    • no two parents define same symbol.
  155. def viewExists(from: Global.Type, to: Global.Type): Boolean

    Permalink
  156. def virtualizedMatch(match_: Global.Match, mode: Mode, pt: Global.Type): Global.Tree

    Permalink
  157. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  158. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  159. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  160. def warnTypeParameterShadow(tparams: List[Global.TypeDef], sym: Global.Symbol): Unit

    Permalink
    Definition Classes
    TyperDiagnostics
  161. final def withCondConstrTyper[T](inConstr: Boolean)(f: (Analyzer.Typer) ⇒ T): T

    Permalink
    Annotations
    @inline()
  162. def wrapClassTagUnapply(uncheckedPattern: Global.Tree, classTagExtractor: Global.Tree, pt: Global.Type): Global.Tree

    Permalink
    Definition Classes
    PatternTyper
  163. def [B](y: B): (Analyzer.Typer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Analyzer.Typer to ArrowAssoc[Analyzer.Typer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Analyzer.PatternTyper

Inherited from Analyzer.Tag

Inherited from Analyzer.Adaptation

Inherited from Analyzer.TyperDiagnostics

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Analyzer.Typer to any2stringadd[Analyzer.Typer]

Inherited by implicit conversion StringFormat from Analyzer.Typer to StringFormat[Analyzer.Typer]

Inherited by implicit conversion Ensuring from Analyzer.Typer to Ensuring[Analyzer.Typer]

Inherited by implicit conversion ArrowAssoc from Analyzer.Typer to ArrowAssoc[Analyzer.Typer]

Ungrouped