@@ -5856,7 +5856,7 @@ object Types {
58565856 tp.derivedAppliedType(tycon, args.map(rangeToBounds)) match
58575857 case tp1 : AppliedType if tp1.isUnreducibleWild =>
58585858 // don't infer a type that would trigger an error later in
5859- // Checling .checkAppliedType; fall through to default handling instead
5859+ // Checking .checkAppliedType; fall through to default handling instead
58605860 case tp1 =>
58615861 return tp1
58625862 end if
@@ -5865,7 +5865,7 @@ object Types {
58655865 // non-range arguments L1, ..., Ln and H1, ..., Hn such that
58665866 // C[L1, ..., Ln] <: C[H1, ..., Hn] by taking the right limits of
58675867 // ranges that appear in as co- or contravariant arguments.
5868- // Fail for non-variant argument ranges.
5868+ // Fail for non-variant argument ranges (see use-site else branch below) .
58695869 // If successful, the L-arguments are in loBut, the H-arguments in hiBuf.
58705870 // @return operation succeeded for all arguments.
58715871 def distributeArgs (args : List [Type ], tparams : List [ParamInfo ]): Boolean = args match {
@@ -5886,8 +5886,11 @@ object Types {
58865886 if (distributeArgs(args, tp.tyconTypeParams))
58875887 range(tp.derivedAppliedType(tycon, loBuf.toList),
58885888 tp.derivedAppliedType(tycon, hiBuf.toList))
5889- else range(defn.NothingType , defn.AnyType )
5890- // TODO: can we give a better bound than `topType`?
5889+ else if tycon.isLambdaSub then
5890+ range(defn.NothingType , defn.AnyType )
5891+ else
5892+ // See lampepfl/dotty#14152
5893+ range(defn.NothingType , tp.derivedAppliedType(tycon, args.map(rangeToBounds)))
58915894 else tp.derivedAppliedType(tycon, args)
58925895 }
58935896
0 commit comments