File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -726,12 +726,17 @@ class Definitions {
726
726
def isBottomType (tp : Type ) =
727
727
tp.derivesFrom(NothingClass ) || tp.derivesFrom(NullClass )
728
728
729
- /** Is a function class.
729
+ /** Is any function class that satisfies:
730
730
* - FunctionN for N >= 0
731
731
* - ImplicitFunctionN for N >= 0
732
732
*/
733
733
def isFunctionClass (cls : Symbol ) = scalaClassName(cls).isFunction
734
734
735
+ /** Is a function class where
736
+ * - FunctionN for N >= 0
737
+ */
738
+ def isPlainFunctionClass (cls : Symbol ) = scalaClassName(cls).isPlainFunction
739
+
735
740
/** Is an implicit function class.
736
741
* - ImplicitFunctionN for N >= 0
737
742
*/
Original file line number Diff line number Diff line change @@ -240,13 +240,17 @@ object NameOps {
240
240
def functionArity : Int =
241
241
functionArityFor(tpnme.Function ) max functionArityFor(tpnme.ImplicitFunction )
242
242
243
- /** Is a function name
243
+ /** Is any function name that satisfies
244
244
* - FunctionN for N >= 0
245
245
* - ImplicitFunctionN for N >= 0
246
- * - false otherwise
247
246
*/
248
247
def isFunction : Boolean = functionArity >= 0
249
248
249
+ /** Is a function name
250
+ * - FunctionN for N >= 0
251
+ */
252
+ def isPlainFunction : Boolean = functionArityFor(tpnme.Function ) >= 0
253
+
250
254
/** Is a implicit function name
251
255
* - ImplicitFunctionN for N >= 0
252
256
* - false otherwise
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ class SpecializeFunction1 extends MiniPhaseTransform with DenotTransformer {
180
180
// Extractors ----------------------------------------------------------------
181
181
private object ShouldTransformDenot {
182
182
def unapply (cref : ClassDenotation )(implicit ctx : Context ): Option [Seq [SpecializationTarget ]] =
183
- if (! cref.classParents.map(_.symbol).exists(defn.isFunctionClass )) None
183
+ if (! cref.classParents.map(_.symbol).exists(defn.isPlainFunctionClass )) None
184
184
else Some (getSpecTargets(cref.typeRef))
185
185
}
186
186
@@ -207,7 +207,7 @@ class SpecializeFunction1 extends MiniPhaseTransform with DenotTransformer {
207
207
val functionParents =
208
208
tpe.classSymbols.iterator
209
209
.flatMap(_.baseClasses)
210
- .filter(defn.isFunctionClass )
210
+ .filter(defn.isPlainFunctionClass )
211
211
212
212
val tpeCls = tpe.widenDealias
213
213
functionParents.map { sym =>
You can’t perform that action at this time.
0 commit comments