@@ -3619,7 +3619,7 @@ object Types {
3619
3619
3620
3620
def companion : LambdaTypeCompanion [ThisName , PInfo , This ]
3621
3621
3622
- def erasedParams = List .fill(paramInfos.size)(false )
3622
+ def erasedParams ( using Context ) = List .fill(paramInfos.size)(false )
3623
3623
3624
3624
/** The type `[tparams := paramRefs] tp`, where `tparams` can be
3625
3625
* either a list of type parameter symbols or a list of lambda parameters
@@ -3910,25 +3910,26 @@ object Types {
3910
3910
3911
3911
final override def isImplicitMethod : Boolean =
3912
3912
companion.eq(ImplicitMethodType ) ||
3913
- companion.isInstanceOf [ ErasedImplicitMethodType ] ||
3913
+ companion.eq( ErasedImplicitMethodType ) ||
3914
3914
isContextualMethod
3915
3915
final override def hasErasedParams : Boolean =
3916
3916
companion.isInstanceOf [ErasedMethodCompanion ]
3917
3917
final override def isContextualMethod : Boolean =
3918
3918
companion.eq(ContextualMethodType ) ||
3919
- companion.isInstanceOf [ ErasedContextualMethodType ]
3919
+ companion.eq( ErasedContextualMethodType )
3920
3920
3921
- override def erasedParams : List [Boolean ] = companion match
3922
- case c : ErasedMethodCompanion => c.erasedParams
3921
+ override def erasedParams ( using Context ) : List [Boolean ] = companion match
3922
+ case c : ErasedMethodCompanion => c.erasedParams(paramInfos)
3923
3923
case _ => super .erasedParams
3924
3924
3925
3925
// Mark erased classes as erased parameters as well.
3926
3926
def markErasedClasses (using Context ): MethodType =
3927
3927
val isErasedClass = paramInfos.map(_.isErasedClass)
3928
3928
if isErasedClass.contains(true ) then companion match
3929
3929
case c : ErasedMethodCompanion =>
3930
- val erasedParams = c.erasedParams.zipWithConserve(isErasedClass) { (a, b) => a || b }
3931
- if erasedParams == c.erasedParams then this
3930
+ val baseErasedParams = c.erasedParams(paramInfos)
3931
+ val erasedParams = baseErasedParams.zipWithConserve(isErasedClass) { (a, b) => a || b }
3932
+ if erasedParams == baseErasedParams then this
3932
3933
else MethodType .companion(
3933
3934
isContextual = isContextualMethod,
3934
3935
isImplicit = isImplicitMethod,
@@ -4055,22 +4056,24 @@ object Types {
4055
4056
def companion (isContextual : Boolean = false , isImplicit : Boolean = false , erasedParams : List [Boolean ] = Nil ): MethodTypeCompanion =
4056
4057
val hasErased = erasedParams.contains(true )
4057
4058
if (isContextual)
4058
- if (hasErased) ErasedContextualMethodType (erasedParams) else ContextualMethodType
4059
+ if (hasErased) ErasedContextualMethodType else ContextualMethodType
4059
4060
else if (isImplicit)
4060
- if (hasErased) ErasedImplicitMethodType (erasedParams) else ImplicitMethodType
4061
+ if (hasErased) ErasedImplicitMethodType else ImplicitMethodType
4061
4062
else
4062
- if (hasErased) ErasedMethodType (erasedParams) else MethodType
4063
+ if (hasErased) ErasedMethodType else MethodType
4063
4064
}
4064
- private def erasedMt (t : String , erasedParams : List [Boolean ]) =
4065
- s " Erased ${t}( ${erasedParams.map(if _ then " erased _" else " _" ).mkString(" , " )}) "
4066
- sealed abstract class ErasedMethodCompanion (prefixString : String , val erasedParams : List [Boolean ])
4067
- extends MethodTypeCompanion (erasedMt(prefixString, erasedParams))
4065
+ sealed abstract class ErasedMethodCompanion (prefixString : String )
4066
+ extends MethodTypeCompanion (" Erased" + prefixString) {
4068
4067
4069
- class ErasedMethodType (erasedParams : List [Boolean ]) extends ErasedMethodCompanion (" MethodType" , erasedParams)
4068
+ def erasedParams (paramsInfo : List [Type ])(using Context ) =
4069
+ paramsInfo.map(_.hasAnnotation(defn.ErasedParamAnnot ))
4070
+ }
4071
+
4072
+ object ErasedMethodType extends ErasedMethodCompanion (" MethodType" )
4070
4073
object ContextualMethodType extends MethodTypeCompanion (" ContextualMethodType" )
4071
- class ErasedContextualMethodType ( erasedParams : List [ Boolean ]) extends ErasedMethodCompanion (" ContextualMethodType" , erasedParams )
4074
+ object ErasedContextualMethodType extends ErasedMethodCompanion (" ContextualMethodType" )
4072
4075
object ImplicitMethodType extends MethodTypeCompanion (" ImplicitMethodType" )
4073
- class ErasedImplicitMethodType ( erasedParams : List [ Boolean ]) extends ErasedMethodCompanion (" ImplicitMethodType" , erasedParams )
4076
+ object ErasedImplicitMethodType extends ErasedMethodCompanion (" ImplicitMethodType" )
4074
4077
4075
4078
/** A ternary extractor for MethodType */
4076
4079
object MethodTpe {
0 commit comments