Skip to content

Commit 9b98936

Browse files
committed
Do not use isErasedFunctionClass
This is broken, especially when dealing with impure functions. I removed the function definition.
1 parent c383812 commit 9b98936

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,15 +1514,6 @@ class Definitions {
15141514
*/
15151515
def isContextFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isContextFunction
15161516

1517-
/** Is an erased function class.
1518-
* - ErasedFunctionN for N > 0
1519-
*
1520-
* This should not be used for checking if a type is an erased function type. Use `isErasedFunctionType`.
1521-
* Only helpful if you have a `RefinedType(parent, nme.apply, mt)` and
1522-
* want to check if `parent` is an erased function class.
1523-
*/
1524-
def isErasedFunctionClass(cls: Symbol): Boolean = scalaClassName(cls).isErasedFunction
1525-
15261517
/** Is either FunctionXXL or a class that will be erased to FunctionXXL
15271518
* - FunctionXXL
15281519
* - FunctionN for N >= 22

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
621621
defn.FunctionType(0)
622622
case RefinedType(parent, nme.apply, refinedInfo) if parent.typeSymbol eq defn.PolyFunctionClass =>
623623
erasePolyFunctionApply(refinedInfo)
624-
case RefinedType(parent, nme.apply, refinedInfo) if defn.isErasedFunctionClass(parent.typeSymbol) =>
624+
case RefinedType(parent, nme.apply, refinedInfo) if defn.isErasedFunctionType(parent) =>
625625
eraseErasedFunctionApply(refinedInfo)
626626
case tp: TypeProxy =>
627627
this(tp.underlying)
@@ -887,7 +887,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
887887
// because RefinedTypes <: TypeProxy and it would be caught by
888888
// the case immediately below
889889
sigName(this(tp))
890-
case tp @ RefinedType(parent, nme.apply, refinedInfo) if defn.isErasedFunctionClass(parent.typeSymbol) =>
890+
case tp @ RefinedType(parent, nme.apply, refinedInfo) if defn.isErasedFunctionType(parent) =>
891891
sigName(this(tp))
892892
case tp: TypeProxy =>
893893
sigName(tp.underlying)

0 commit comments

Comments
 (0)