Skip to content

Commit 396acbf

Browse files
committed
Add comment explaining approximating derivedAppliedType
1 parent 4160921 commit 396acbf

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
@@ -3982,6 +3982,13 @@ object Types {
39823982
if (variance > 0) tp.derivedAppliedType(tycon, args.map(rangeToBounds))
39833983
else {
39843984
val loBuf, hiBuf = new mutable.ListBuffer[Type]
3985+
// Given `C[A1, ..., An]` where sone A's are ranges, try to find
3986+
// non-range arguments L1, ..., Ln and H1, ..., Hn such that
3987+
// C[L1, ..., Ln] <: C[H1, ..., Hn] by taking the right limits of
3988+
// ranges that appear in as co- or contravariant arguments.
3989+
// Fail for non-variant argument ranges.
3990+
// If successful, the L-arguments are in loBut, the H-arguments in hiBuf.
3991+
// @return operation succeeded for all arguments.
39853992
def distributeArgs(args: List[Type], tparams: List[ParamInfo]): Boolean = args match {
39863993
case Range(lo, hi) :: args1 =>
39873994
val v = tparams.head.paramVariance

0 commit comments

Comments
 (0)