@@ -1991,7 +1991,7 @@ object Types {
1991
1991
* prefix `pre`. Can produce a TypeBounds type in case prefix is an & or | type
1992
1992
* and parameter is non-variant.
1993
1993
*/
1994
- def argForParam (pre : Type , variance : Int )(implicit ctx : Context ): Type = {
1994
+ def argForParam (pre : Type )(implicit ctx : Context ): Type = {
1995
1995
val tparam = symbol
1996
1996
val cls = tparam.owner
1997
1997
val base = pre.baseType(cls)
@@ -2012,16 +2012,17 @@ object Types {
2012
2012
}
2013
2013
NoType
2014
2014
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
2017
2018
if (tp1.isInstanceOf [TypeBounds ] || tp2.isInstanceOf [TypeBounds ] || variance == 0 ) {
2018
2019
// compute argument as a type bounds instead of a point type
2019
2020
tp1 = tp1.bounds
2020
2021
tp2 = tp2.bounds
2021
2022
}
2022
2023
if (base.isAnd == variance >= 0 ) tp1 & tp2 else tp1 | tp2
2023
2024
case _ =>
2024
- if (pre.termSymbol is Package ) argForParam(pre.select(nme.PACKAGE ), variance )
2025
+ if (pre.termSymbol is Package ) argForParam(pre.select(nme.PACKAGE ))
2025
2026
else if (pre.isBottomType) pre
2026
2027
else NoType
2027
2028
}
@@ -2045,7 +2046,7 @@ object Types {
2045
2046
else {
2046
2047
if (isType) {
2047
2048
val res =
2048
- if (currentSymbol.is(ClassTypeParam )) argForParam(prefix, symbol.paramVariance )
2049
+ if (currentSymbol.is(ClassTypeParam )) argForParam(prefix)
2049
2050
else prefix.lookupRefined(name)
2050
2051
if (res.exists) return res
2051
2052
if (Config .splitProjections)
@@ -4474,7 +4475,7 @@ object Types {
4474
4475
def expandParam (tp : NamedType , pre : Type ): Type = {
4475
4476
def expandBounds (tp : TypeBounds ) =
4476
4477
range(atVariance(- variance)(reapply(tp.lo)), reapply(tp.hi))
4477
- tp.argForParam(pre, tp.symbol.paramVariance ) match {
4478
+ tp.argForParam(pre) match {
4478
4479
case arg @ TypeRef (pre, _) if pre.isArgPrefixOf(arg.symbol) =>
4479
4480
arg.info match {
4480
4481
case argInfo : TypeBounds => expandBounds(argInfo)
0 commit comments