Skip to content

Commit 1440b25

Browse files
committed
Add comment explaining approximating derivedAppliedType
1 parent 0dae33c commit 1440b25

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,6 +3985,13 @@ object Types {
39853985
if (variance > 0) tp.derivedAppliedType(tycon, args.map(rangeToBounds))
39863986
else {
39873987
val loBuf, hiBuf = new mutable.ListBuffer[Type]
3988+
// Given `C[A1, ..., An]` where sone A's are ranges, try to find
3989+
// non-range arguments L1, ..., Ln and H1, ..., Hn such that
3990+
// C[L1, ..., Ln] <: C[H1, ..., Hn] by taking the right limits of
3991+
// ranges that appear in as co- or contravariant arguments.
3992+
// Fail for non-variant argument ranges.
3993+
// If successful, the L-arguments are in loBut, the H-arguments in hiBuf.
3994+
// @return operation succeeded for all arguments.
39883995
def distributeArgs(args: List[Type], tparams: List[ParamInfo]): Boolean = args match {
39893996
case Range(lo, hi) :: args1 =>
39903997
val v = tparams.head.paramVariance

0 commit comments

Comments
 (0)