Skip to content

Commit ad6cb52

Browse files
committed
Update doc comment on HkTypeLambda/PolyType
1 parent b1f56ac commit ad6cb52

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,17 @@ object Types {
26892689
}
26902690
}
26912691

2692+
/** A type lambda of the form `[X_0 B_0, ..., X_n B_n] => T`
2693+
* Variances are encoded in parameter names. A name starting with `+`
2694+
* designates a covariant parameter, a name starting with `-` designates
2695+
* a contravariant parameter, and every other name designates a non-variant parameter.
2696+
*
2697+
* @param paramNames The names `X_0`, ..., `X_n`
2698+
* @param paramInfosExp A function that, given the polytype itself, returns the
2699+
* parameter bounds `B_1`, ..., `B_n`
2700+
* @param resultTypeExp A function that, given the polytype itself, returns the
2701+
* result type `T`.
2702+
*/
26922703
class HKTypeLambda(val paramNames: List[TypeName])(
26932704
paramInfosExp: HKTypeLambda => List[TypeBounds], resultTypeExp: HKTypeLambda => Type)
26942705
extends HKLambda with TypeLambda {
@@ -2704,18 +2715,8 @@ object Types {
27042715
protected def prefixString = "HKTypeLambda"
27052716
}
27062717

2707-
/** A type lambda of the form `[X_0 B_0, ..., X_n B_n] => T`
2708-
* This is used both as a type of a polymorphic method and as a type of
2709-
* a higher-kinded type parameter. Variances are encoded in parameter
2710-
* names. A name starting with `+` designates a covariant parameter,
2711-
* a name starting with `-` designates a contravariant parameter,
2712-
* and every other name designates a non-variant parameter.
2713-
*
2714-
* @param paramNames The names `X_0`, ..., `X_n`
2715-
* @param paramInfosExp A function that, given the polytype itself, returns the
2716-
* parameter bounds `B_1`, ..., `B_n`
2717-
* @param resultTypeExp A function that, given the polytype itself, returns the
2718-
* result type `T`.
2718+
/** The type of a polymorphic method. It has the same form as HKTypeLambda,
2719+
* except it applies to terms and parameters do not have variances.
27192720
*/
27202721
class PolyType(val paramNames: List[TypeName])(
27212722
paramInfosExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)

0 commit comments

Comments
 (0)