ProtoTypes

dotty.tools.dotc.typer.ProtoTypes$
object ProtoTypes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

A prototype for expressions [] that are known to be functions:

A prototype for expressions [] that are known to be functions:

[] _

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Self type

A prototype for expressions [] that are in some unspecified selection operation

A prototype for expressions [] that are in some unspecified selection operation

[].?: ?

Used to indicate that expression is in a context where the only valid operation is further selection. In this case, the expression need not be a value.

Attributes

See also:

checkValue

Graph
Supertypes
trait Product
trait Equals
trait TermType
trait ProtoType
class TypeProxy
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Self type

A prototype for type constructors that are followed by a type application

A prototype for type constructors that are followed by a type application

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Self type
trait ApplyingProto extends ProtoType

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Self type
final class CachedIgnoredProto(ignored: Type) extends IgnoredProto

Attributes

Graph
Supertypes
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
class CachedSelectionProto(name: Name, memberProto: Type, compat: Compatibility, privateOK: Boolean) extends SelectionProto

Attributes

Graph
Supertypes
trait Product
trait Equals
trait TermType
trait ProtoType
class TypeProxy
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
class CachedViewProto(argType: Type, resultType: Type) extends ViewProto

Attributes

Graph
Supertypes
class ViewProto
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any

A trait defining an isCompatible method.

A trait defining an isCompatible method.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Typer
class ReTyper
class Typer
class Checker
object NoViewsAllowed.type

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes
case class FunProto(args: List[Tree], resType: Type)(typer: Typer, applyKind: ApplyKind, state: FunProtoState, constrainResultDeep: Boolean)(using protoCtx: Context) extends UncachedGroundType with ApplyingProto with FunOrPolyProto

A prototype for expressions that appear in function position

A prototype for expressions that appear in function position

: resultType

Attributes

applyKind

The kind of application (regular/using/tupled infix operand)

args

The untyped arguments to which the function is applied

constrainResultDeep

A flag to indicate that constrainResult on this prototype should typecheck and compare the arguments.

resType

The expeected result type

state

The state object to use for tracking the changes to this prototype

typer

The typer to use for typing the arguments

Graph
Supertypes
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
class FunProtoTyped(args: List[Tree], resultType: Type)(typer: Typer, applyKind: ApplyKind)(using x$5: Context) extends FunProto

A prototype for expressions that appear in function position

A prototype for expressions that appear in function position

: resultType, where args are known to be typed

Attributes

Graph
Supertypes
class FunProto
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
abstract case class IgnoredProto(ignored: Type) extends CachedGroundType with MatchAlways

A class marking ignored prototypes that can be revealed by deepenProto

A class marking ignored prototypes that can be revealed by deepenProto

Attributes

Companion:
object
Graph
Supertypes
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
trait MatchAlways extends ProtoType

A trait for prototypes that match all types

A trait for prototypes that match all types

Attributes

Graph
Supertypes
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
case class PolyProto(targs: List[Tree], resType: Type) extends UncachedGroundType with FunOrPolyProto

A prototype for expressions [] that are type-parameterized:

A prototype for expressions [] that are type-parameterized:

[] [targs] resultType

Attributes

Graph
Supertypes
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
abstract case class SelectionProto(name: Name, memberProto: Type, compat: Compatibility, privateOK: Boolean) extends CachedProxyType with ProtoType with ValueTypeOrProto

A prototype for expressions [] that are part of a selection operation:

A prototype for expressions [] that are part of a selection operation:

 [ ].name: proto

Attributes

Companion:
object
Graph
Supertypes
trait Product
trait Equals
trait TermType
trait ProtoType
class TypeProxy
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

A prototype for selections in pattern constructors

A prototype for selections in pattern constructors

Attributes

Graph
Supertypes
trait Product
trait Equals
trait TermType
trait ProtoType
class TypeProxy
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
abstract case class ViewProto(argType: Type, resType: Type) extends CachedGroundType with ApplyingProto

A prototype for implicitly inferred views:

A prototype for implicitly inferred views:

[]: argType => resultType

Attributes

Companion:
object
Graph
Supertypes
trait Product
trait Equals
trait ProtoType
class Type
trait Showable
trait Hashable
class Object
trait Matchable
class Any
Known subtypes
object ViewProto

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Dummy tree to be used as an argument of a FunProto or ViewProto type

Dummy tree to be used as an argument of a FunProto or ViewProto type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def constrained(using Context)(tl: TypeLambda, owningTree: Tree, alwaysAddTypeVars: Boolean, nestingLevel: Int): (TypeLambda, List[TypeTree])

Add all parameters of given type lambda tl to the constraint's domain. If the constraint contains already some of these parameters in its domain, make a copy of the type lambda and add the copy's type parameters instead. Return either the original type lambda, or the copy, if one was made. Also, if owningTree is non-empty or alwaysAddTypeVars is true, add a type variable for each parameter.

Add all parameters of given type lambda tl to the constraint's domain. If the constraint contains already some of these parameters in its domain, make a copy of the type lambda and add the copy's type parameters instead. Return either the original type lambda, or the copy, if one was made. Also, if owningTree is non-empty or alwaysAddTypeVars is true, add a type variable for each parameter.

Attributes

Returns:

The added type lambda, and the list of created type variables.

def constrained(tl: TypeLambda, owningTree: Tree)(using Context): (TypeLambda, List[TypeTree])

Same as constrained(tl, EmptyTree), but returns just the created type lambda

Same as constrained(tl, EmptyTree), but returns just the created type lambda

Attributes

Instantiate tl with fresh type variables added to the constraint.

Instantiate tl with fresh type variables added to the constraint.

Attributes

Create a new TypeVar that represents a dependent method parameter singleton ref

Create a new TypeVar that represents a dependent method parameter singleton ref

Attributes

def newTypeVar(using Context)(bounds: TypeBounds, name: TypeName, nestingLevel: Int, represents: Type): TypeVar

A fresh type variable added to the current constraint.

A fresh type variable added to the current constraint.

Attributes

bounds

The initial bounds of the variable

name

The name of the variable, defaults a fresh DepParamName

nestingLevel

See TypeVar#nestingLevel

represents

If it exists, a ParamRef that this TypeVar represents, to be retrieved using representedParamRef. in the substitution generated by resultTypeApprox If represents exists, it is stored in the result type of the PolyType that backs the TypeVar, to be retrieved by representedParamRef.

def normalize(tp: Type, pt: Type, followIFT: Boolean)(using Context): Type

The normalized form of a type

The normalized form of a type

  • instantiate polymorphic types with fresh type variables in the current constraint
  • skips implicit parameters of methods and functions; if result type depends on implicit parameter, replace with wildcard.
  • converts non-dependent method types to the corresponding function types unless the expected type is an ApplyingProto or IgnoredProto.
  • dereferences parameterless method types
  • dereferences nullary method types provided the corresponding function type is not a subtype of the expected type. Note: We need to take account of the possibility of inserting a () argument list in normalization. Otherwise, a type with a def toString(): String member would not count as a valid solution for ?{toString: String}. This would then lead to an implicit insertion, with a nice explosion of inference search because of course every implicit result has some sort of toString method. The problem is solved by dereferencing nullary method types if the corresponding function type is not compatible with the prototype.

Attributes

If param was created using newTypeVar(..., represents = X), returns X. This is used in:

If param was created using newTypeVar(..., represents = X), returns X. This is used in:

  • Inferencing#constrainIfDependentParamRef to retrieve the dependent function parameter for which the variable was substituted.
  • ConstraintHandling#LevelAvoidMap#legalVar to retrieve the type variable that was avoided in a previous call to legalVar.

Attributes

def resultTypeApprox(mt: MethodType, wildcardOnly: Boolean)(using Context): Type

The result type of mt, where all references to parameters of mt are replaced by either wildcards or TypeParamRefs.

The result type of mt, where all references to parameters of mt are replaced by either wildcards or TypeParamRefs.

Attributes

def shallowSelectionProto(name: Name, tp: Type, typer: Typer)(using Context): TermType

Create a selection proto-type, but only one level deep; treat constructors specially

Create a selection proto-type, but only one level deep; treat constructors specially

Attributes

final def wildApprox(tp: Type)(using Context): Type

Extensions

Extensions

extension (pt: Type)