Skip to content

Commit 0068147

Browse files
committed
Start ErasedFunctionN and ErasedImplicitFunctionN at N=1
1 parent 46c1ce4 commit 0068147

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -894,26 +894,23 @@ class Definitions {
894894
def isBottomType(tp: Type) =
895895
tp.derivesFrom(NothingClass) || tp.derivesFrom(NullClass)
896896

897-
/** Is a function class, i.e. on of
898-
* - FunctionN
899-
* - ImplicitFunctionN
900-
* - ErasedFunctionN
901-
* - ErasedImplicitFunctionN
902-
* for N >= 0
897+
/** Is a function class.
898+
* - FunctionN for N >= 0
899+
* - ImplicitFunctionN for N >= 0
900+
* - ErasedFunctionN for N > 0
901+
* - ErasedImplicitFunctionN for N > 0
903902
*/
904903
def isFunctionClass(cls: Symbol) = scalaClassName(cls).isFunction
905904

906905
/** Is an implicit function class.
907-
* - ImplicitFunctionN
908-
* - ErasedImplicitFunctionN
909-
* for N >= 0
906+
* - ImplicitFunctionN for N >= 0
907+
* - ErasedImplicitFunctionN for N > 0
910908
*/
911909
def isImplicitFunctionClass(cls: Symbol) = scalaClassName(cls).isImplicitFunction
912910

913911
/** Is an erased function class.
914-
* - ErasedFunctionN
915-
* - ErasedImplicitFunctionN
916-
* for N >= 0
912+
* - ErasedFunctionN for N > 0
913+
* - ErasedImplicitFunctionN for N > 0
917914
*/
918915
def isErasedFunctionClass(cls: Symbol) = scalaClassName(cls).isErasedFunction
919916

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,33 +169,36 @@ object NameOps {
169169

170170
def functionArity: Int =
171171
functionArityFor(str.Function) max
172-
functionArityFor(str.ImplicitFunction) max
173-
functionArityFor(str.ErasedFunction) max
174-
functionArityFor(str.ErasedImplicitFunction)
172+
functionArityFor(str.ImplicitFunction) max {
173+
val n =
174+
functionArityFor(str.ErasedFunction) max
175+
functionArityFor(str.ErasedImplicitFunction)
176+
if (n == 0) -1 else n
177+
}
175178

176-
/** Is a function name, i.e one of FunctionN, ImplicitFunctionN, ErasedFunctionN, ErasedImplicitFunctionN for N >= 0
179+
/** Is a function name, i.e one of FunctionN, ImplicitFunctionN for N >= 0 or ErasedFunctionN, ErasedImplicitFunctionN for N > 0
177180
*/
178181
def isFunction: Boolean = functionArity >= 0
179182

180-
/** Is an implicit function name, i.e one of ImplicitFunctionN, ErasedImplicitFunctionN for N >= 0
183+
/** Is an implicit function name, i.e one of ImplicitFunctionN for N >= 0 or ErasedImplicitFunctionN for N > 0
181184
*/
182185
def isImplicitFunction: Boolean = {
183186
functionArityFor(str.ImplicitFunction) >= 0 ||
184-
functionArityFor(str.ErasedImplicitFunction) >= 0
187+
functionArityFor(str.ErasedImplicitFunction) > 0
185188
}
186189

187-
/** Is an erased function name, i.e. one of ErasedFunctionN, ErasedImplicitFunctionN for N >= 0
190+
/** Is an erased function name, i.e. one of ErasedFunctionN, ErasedImplicitFunctionN for N > 0
188191
*/
189192
def isErasedFunction: Boolean = {
190-
functionArityFor(str.ErasedFunction) >= 0 ||
191-
functionArityFor(str.ErasedImplicitFunction) >= 0
193+
functionArityFor(str.ErasedFunction) > 0 ||
194+
functionArityFor(str.ErasedImplicitFunction) > 0
192195
}
193196

194197
/** Is a synthetic function name, i.e. one of
195198
* - FunctionN for N > 22
196199
* - ImplicitFunctionN for N >= 0
197-
* - ErasedFunctionN for N >= 0
198-
* - ErasedImplicitFunctionN for N >= 0
200+
* - ErasedFunctionN for N > 0
201+
* - ErasedImplicitFunctionN for N > 0
199202
*/
200203
def isSyntheticFunction: Boolean = {
201204
functionArityFor(str.Function) > MaxImplementedFunctionArity ||

0 commit comments

Comments
 (0)