Rechecker

dotty.tools.dotc.transform.Recheck.Rechecker
class Rechecker(ictx: Context)

The typechecker pass

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Value members

Concrete methods

def checkConforms(tpe: Type, pt: Type, tree: Tree)(using Context): Unit

Check that widened types of tpe and pt are compatible.

Check that widened types of tpe and pt are compatible.

Attributes

def checkConformsExpr(actual: Type, expected: Type, tree: Tree)(using Context): Unit
def keepType(tree: Tree): Boolean

Should type of tree be kept in an attachment so that it can be retrieved with knownType? By default true only is keepAllTypes hold, but can be overridden.

Should type of tree be kept in an attachment so that it can be retrieved with knownType? By default true only is keepAllTypes hold, but can be overridden.

Attributes

When we select the apply of a function with type such as (=> A) => B, we need to convert the parameter type => A to () ?=> A. See doc comment of mapExprType.

When we select the apply of a function with type such as (=> A) => B, we need to convert the parameter type => A to () ?=> A. See doc comment of mapExprType.

Attributes

def recheck(tree: Tree, pt: Type)(using Context): Type
def recheckApply(tree: Apply, pt: Type)(using Context): Type
def recheckAssign(tree: Assign)(using Context): Type
def recheckBind(tree: Bind, pt: Type)(using Context): Type
def recheckBlock(stats: List[Tree], expr: Tree, pt: Type)(using Context): Type
def recheckBlock(tree: Block, pt: Type)(using Context): Type
def recheckCase(tree: CaseDef, selType: Type, pt: Type)(using Context): Type
def recheckClassDef(tree: TypeDef, impl: Template, sym: ClassSymbol)(using Context): Type
def recheckClosure(tree: Closure, pt: Type)(using Context): Type
def recheckDef(tree: ValOrDefDef, sym: Symbol)(using Context): Unit
def recheckDefDef(tree: DefDef, sym: Symbol)(using Context): Unit
def recheckFinish(tpe: Type, tree: Tree, pt: Type)(using Context): Type

Finish rechecking a tree node: check rechecked type against expected type and remember rechecked type in a tree attachment if required.

Finish rechecking a tree node: check rechecked type against expected type and remember rechecked type in a tree attachment if required.

Attributes

pt

the expected type

tpe

the recheched type of tree

tree

the rechecked tree

def recheckIdent(tree: Ident)(using Context): Type
def recheckIf(tree: If, pt: Type)(using Context): Type
def recheckInlined(tree: Inlined, pt: Type)(using Context): Type
def recheckLabeled(tree: Labeled, pt: Type)(using Context): Type
def recheckMatch(tree: Match, pt: Type)(using Context): Type
def recheckReturn(tree: Return)(using Context): Type
def recheckSelect(tree: Select, pt: Type)(using Context): Type
def recheckSelection(tree: Select, qualType: Type, name: Name, sharpen: Denotation => Denotation)(using Context): Type
def recheckSelection(tree: Select, qualType: Type, name: Name, pt: Type)(using Context): Type

Keep the symbol of the select but re-infer its type

Keep the symbol of the select but re-infer its type

Attributes

def recheckSeqLiteral(tree: SeqLiteral, pt: Type)(using Context): Type
def recheckStart(tree: Tree, pt: Type)(using Context): Type

Recheck tree without adapting it, returning its new type.

Recheck tree without adapting it, returning its new type.

Attributes

pt

the expected result type

tree

the original tree

def recheckStats(stats: List[Tree])(using Context): Unit
def recheckTry(tree: Try, pt: Type)(using Context): Type
def recheckTypeApply(tree: TypeApply, pt: Type)(using Context): Type
def recheckTypeDef(tree: TypeDef, sym: Symbol)(using Context): Type
def recheckTyped(tree: Typed)(using Context): Type
def recheckValDef(tree: ValDef, sym: Symbol)(using Context): Unit
def recheckWhileDo(tree: WhileDo)(using Context): Type
def reset()(using Context): Unit
def widenSkolems(tp: Type)(using Context): Type

Typing and previous transforms sometiems leaves skolem types in prefixes of NamedTypes in expected that do not match the actual Type. -Ycheck does not complain (need to find out why), but a full recheck does. We compensate by de-skolemizing everywhere in expected except when variance is negative.

Typing and previous transforms sometiems leaves skolem types in prefixes of NamedTypes in expected that do not match the actual Type. -Ycheck does not complain (need to find out why), but a full recheck does. We compensate by de-skolemizing everywhere in expected except when variance is negative.

Attributes

Returns:

If tp contains SkolemTypes in covariant or invariant positions, the type where these SkolemTypes are mapped to their underlying type. Otherwise, tp itself