From 4939b47bf3c2f74664e3976f23d82987ebf1ab43 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 20 Mar 2017 08:52:06 +0100 Subject: Update doc comment on HkTypeLambda/PolyType --- compiler/src/dotty/tools/dotc/core/Types.scala | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala') diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 0a23157c8..83fb70aa1 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -2693,6 +2693,17 @@ object Types { } } + /** A type lambda of the form `[X_0 B_0, ..., X_n B_n] => T` + * Variances are encoded in parameter names. A name starting with `+` + * designates a covariant parameter, a name starting with `-` designates + * a contravariant parameter, and every other name designates a non-variant parameter. + * + * @param paramNames The names `X_0`, ..., `X_n` + * @param paramInfosExp A function that, given the polytype itself, returns the + * parameter bounds `B_1`, ..., `B_n` + * @param resultTypeExp A function that, given the polytype itself, returns the + * result type `T`. + */ class HKTypeLambda(val paramNames: List[TypeName])( paramInfosExp: HKTypeLambda => List[TypeBounds], resultTypeExp: HKTypeLambda => Type) extends HKLambda with TypeLambda { @@ -2708,18 +2719,8 @@ object Types { protected def prefixString = "HKTypeLambda" } - /** A type lambda of the form `[X_0 B_0, ..., X_n B_n] => T` - * This is used both as a type of a polymorphic method and as a type of - * a higher-kinded type parameter. Variances are encoded in parameter - * names. A name starting with `+` designates a covariant parameter, - * a name starting with `-` designates a contravariant parameter, - * and every other name designates a non-variant parameter. - * - * @param paramNames The names `X_0`, ..., `X_n` - * @param paramInfosExp A function that, given the polytype itself, returns the - * parameter bounds `B_1`, ..., `B_n` - * @param resultTypeExp A function that, given the polytype itself, returns the - * result type `T`. + /** The type of a polymorphic method. It has the same form as HKTypeLambda, + * except it applies to terms and parameters do not have variances. */ class PolyType(val paramNames: List[TypeName])( paramInfosExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type) -- cgit v1.2.3