Skip to content

Commit 4939b47

Browse files
committed
Update doc comment on HkTypeLambda/PolyType
1 parent d101f49 commit 4939b47

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
@@ -2693,6 +2693,17 @@ object Types {
26932693
}
26942694
}
26952695

2696+
/** A type lambda of the form `[X_0 B_0, ..., X_n B_n] => T`
2697+
* Variances are encoded in parameter names. A name starting with `+`
2698+
* designates a covariant parameter, a name starting with `-` designates
2699+
* a contravariant parameter, and every other name designates a non-variant parameter.
2700+
*
2701+
* @param paramNames The names `X_0`, ..., `X_n`
2702+
* @param paramInfosExp A function that, given the polytype itself, returns the
2703+
* parameter bounds `B_1`, ..., `B_n`
2704+
* @param resultTypeExp A function that, given the polytype itself, returns the
2705+
* result type `T`.
2706+
*/
26962707
class HKTypeLambda(val paramNames: List[TypeName])(
26972708
paramInfosExp: HKTypeLambda => List[TypeBounds], resultTypeExp: HKTypeLambda => Type)
26982709
extends HKLambda with TypeLambda {
@@ -2708,18 +2719,8 @@ object Types {
27082719
protected def prefixString = "HKTypeLambda"
27092720
}
27102721

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

0 commit comments

Comments
 (0)