Skip to content

Commit 76ee734

Browse files
committed
Make argForParam not take a variance parameter
1 parent fc9f114 commit 76ee734

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ object Types {
19911991
* prefix `pre`. Can produce a TypeBounds type in case prefix is an & or | type
19921992
* and parameter is non-variant.
19931993
*/
1994-
def argForParam(pre: Type, variance: Int)(implicit ctx: Context): Type = {
1994+
def argForParam(pre: Type)(implicit ctx: Context): Type = {
19951995
val tparam = symbol
19961996
val cls = tparam.owner
19971997
val base = pre.baseType(cls)
@@ -2012,16 +2012,17 @@ object Types {
20122012
}
20132013
NoType
20142014
case base: AndOrType =>
2015-
var tp1 = argForParam(base.tp1, variance)
2016-
var tp2 = argForParam(base.tp2, variance)
2015+
var tp1 = argForParam(base.tp1)
2016+
var tp2 = argForParam(base.tp2)
2017+
val variance = tparam.paramVariance
20172018
if (tp1.isInstanceOf[TypeBounds] || tp2.isInstanceOf[TypeBounds] || variance == 0) {
20182019
// compute argument as a type bounds instead of a point type
20192020
tp1 = tp1.bounds
20202021
tp2 = tp2.bounds
20212022
}
20222023
if (base.isAnd == variance >= 0) tp1 & tp2 else tp1 | tp2
20232024
case _ =>
2024-
if (pre.termSymbol is Package) argForParam(pre.select(nme.PACKAGE), variance)
2025+
if (pre.termSymbol is Package) argForParam(pre.select(nme.PACKAGE))
20252026
else if (pre.isBottomType) pre
20262027
else NoType
20272028
}
@@ -2045,7 +2046,7 @@ object Types {
20452046
else {
20462047
if (isType) {
20472048
val res =
2048-
if (currentSymbol.is(ClassTypeParam)) argForParam(prefix, symbol.paramVariance)
2049+
if (currentSymbol.is(ClassTypeParam)) argForParam(prefix)
20492050
else prefix.lookupRefined(name)
20502051
if (res.exists) return res
20512052
if (Config.splitProjections)
@@ -4474,7 +4475,7 @@ object Types {
44744475
def expandParam(tp: NamedType, pre: Type): Type = {
44754476
def expandBounds(tp: TypeBounds) =
44764477
range(atVariance(-variance)(reapply(tp.lo)), reapply(tp.hi))
4477-
tp.argForParam(pre, tp.symbol.paramVariance) match {
4478+
tp.argForParam(pre) match {
44784479
case arg @ TypeRef(pre, _) if pre.isArgPrefixOf(arg.symbol) =>
44794480
arg.info match {
44804481
case argInfo: TypeBounds => expandBounds(argInfo)

0 commit comments

Comments
 (0)