File tree 2 files changed +5
-1
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1475,6 +1475,7 @@ class Definitions {
1475
1475
def PolyFunctionType = PolyFunctionClass .typeRef
1476
1476
1477
1477
lazy val ErasedFunctionClass = requiredClass(" scala.runtime.ErasedFunction" )
1478
+ def ErasedFunctionType = ErasedFunctionClass .typeRef
1478
1479
1479
1480
/** If `cls` is a class in the scala package, its name, otherwise EmptyTypeName */
1480
1481
def scalaClassName (cls : Symbol )(using Context ): TypeName = cls.denot match
Original file line number Diff line number Diff line change @@ -1875,7 +1875,7 @@ object Types {
1875
1875
* @param alwaysDependent if true, always create a dependent function type.
1876
1876
*/
1877
1877
def toFunctionType (isJava : Boolean , dropLast : Int = 0 , alwaysDependent : Boolean = false )(using Context ): Type = this match {
1878
- case mt : MethodType if ! mt.isParamDependent =>
1878
+ case mt : MethodType if ! mt.isParamDependent && ! mt.hasErasedParams =>
1879
1879
val formals1 = if (dropLast == 0 ) mt.paramInfos else mt.paramInfos dropRight dropLast
1880
1880
val isContextual = mt.isContextualMethod && ! ctx.erasedTypes
1881
1881
val result1 = mt.nonDependentResultApprox match {
@@ -1888,6 +1888,9 @@ object Types {
1888
1888
if alwaysDependent || mt.isResultDependent then
1889
1889
RefinedType (funType, nme.apply, mt)
1890
1890
else funType
1891
+ case mt : MethodType if ! mt.isParamDependent =>
1892
+ assert(mt.hasErasedParams)
1893
+ RefinedType (defn.ErasedFunctionType , nme.apply, mt)
1891
1894
case poly @ PolyType (_, mt : MethodType ) if ! mt.isParamDependent =>
1892
1895
RefinedType (defn.PolyFunctionType , nme.apply, poly)
1893
1896
}
You can’t perform that action at this time.
0 commit comments