Skip to content

Commit 433e9cf

Browse files
committed
Merge pull request #333 from olhotak/pr-addcomments
Add/clarify comments for ExprType and TypeVar
2 parents dbeceba + 1815894 commit 433e9cf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,7 @@ object Types {
20402040
unique(new ImplicitMethodType(paramNames, paramTypes)(resultTypeExp))
20412041
}
20422042

2043+
/** A by-name parameter type of the form `=> T`, or the type of a method with no parameter list. */
20432044
abstract case class ExprType(override val resultType: Type)
20442045
extends CachedProxyType with TermType with MethodicType {
20452046
override def underlying(implicit ctx: Context): Type = resultType
@@ -2184,13 +2185,16 @@ object Types {
21842185

21852186
// ------------ Type variables ----------------------------------------
21862187

2187-
/** A type variable is essentially a switch that models some part of a substitution.
2188+
/** In a TypeApply tree, a TypeVar is created for each argument type to be inferred.
2189+
* Every type variable is referred to by exactly one inferred type parameter of some
2190+
* TypeApply tree.
2191+
*
2192+
* A type variable is essentially a switch that models some part of a substitution.
21882193
* It is first linked to `origin`, a poly param that's in the current constraint set.
21892194
* It can then be (once) instantiated to some other type. The instantiation is
21902195
* recorded in the type variable itself, or else, if the current type state
21912196
* is different from the variable's creation state (meaning unrolls are possible)
2192-
* in the current typer state. Every type variable is referred to by exactly
2193-
* one inferred type parameter in a TypeApply tree.
2197+
* in the current typer state.
21942198
*
21952199
* @param origin The parameter that's tracked by the type variable.
21962200
* @param creatorState The typer state in which the variable was created.

0 commit comments

Comments
 (0)