@@ -2204,13 +2204,6 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2204
2204
case _ => None
2205
2205
end MethodOrPolyTypeTest
2206
2206
2207
- type MethodTypeKind = dotc.core.Types .MethodTypeCompanion
2208
-
2209
- object MethodTypeKind extends MethodTypeKindModule :
2210
- val Plain : MethodTypeKind = Types .MethodType
2211
- val Contextual : MethodTypeKind = Types .ContextualMethodType
2212
- val Implicit : MethodTypeKind = Types .ImplicitMethodType
2213
-
2214
2207
type MethodType = dotc.core.Types .MethodType
2215
2208
2216
2209
object MethodTypeTypeTest extends TypeTest [TypeRepr , MethodType ]:
@@ -2223,7 +2216,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2223
2216
def apply (paramNames : List [String ])(paramInfosExp : MethodType => List [TypeRepr ], resultTypeExp : MethodType => TypeRepr ): MethodType =
2224
2217
Types .MethodType (paramNames.map(_.toTermName))(paramInfosExp, resultTypeExp)
2225
2218
def apply (kind : MethodTypeKind )(paramNames : List [String ])(paramInfosExp : MethodType => List [TypeRepr ], resultTypeExp : MethodType => TypeRepr ): MethodType =
2226
- kind.apply(paramNames.map(_.toTermName))(paramInfosExp, resultTypeExp)
2219
+ val companion = kind match
2220
+ case MethodTypeKind .Contextual => Types .ContextualMethodType
2221
+ case MethodTypeKind .Implicit => Types .ImplicitMethodType
2222
+ case MethodTypeKind .Plain => Types .MethodType
2223
+ companion.apply(paramNames.map(_.toTermName))(paramInfosExp, resultTypeExp)
2227
2224
def unapply (x : MethodType ): (List [String ], List [TypeRepr ], TypeRepr ) =
2228
2225
(x.paramNames.map(_.toString), x.paramTypes, x.resType)
2229
2226
end MethodType
@@ -2233,7 +2230,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2233
2230
def isErased : Boolean = false
2234
2231
def isImplicit : Boolean = self.isImplicitMethod
2235
2232
def isContextual : Boolean = self.isContextualMethod
2236
- def methodTypeKind : MethodTypeKind = self.companion
2233
+ def methodTypeKind : MethodTypeKind =
2234
+ self.companion match
2235
+ case Types .ContextualMethodType => MethodTypeKind .Contextual
2236
+ case Types .ImplicitMethodType => MethodTypeKind .Implicit
2237
+ case _ => MethodTypeKind .Plain
2237
2238
def param (idx : Int ): TypeRepr = self.newParamRef(idx)
2238
2239
2239
2240
def erasedParams : List [Boolean ] = self.erasedParams
0 commit comments