Skip to content

Commit 8d17f57

Browse files
committed
Add comment explaining approximating derivedAppliedType
1 parent 104516b commit 8d17f57

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

0 commit comments

Comments
 (0)