Skip to content

Commit 9ea9bf5

Browse files
committed
Update NameOps to disregard ImplicitFuncion0 as a function name
1 parent cf346d4 commit 9ea9bf5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,36 @@ object NameOps {
156156

157157
/** Is a synthetic function name
158158
* - N for FunctionN
159-
* - N for ImplicitFunctionN
159+
* - N for ImplicitFunctionN (N >= 1)
160160
* - (-1) otherwise
161161
*/
162162
def functionArity: Int =
163-
functionArityFor(str.Function) max functionArityFor(str.ImplicitFunction)
163+
functionArityFor(str.Function) max {
164+
val n = functionArityFor(str.ImplicitFunction)
165+
if (n == 0) -1 else n
166+
}
164167

165168
/** Is a function name
166169
* - FunctionN for N >= 0
167-
* - ImplicitFunctionN for N >= 0
170+
* - ImplicitFunctionN for N >= 1
168171
* - false otherwise
169172
*/
170173
def isFunction: Boolean = functionArity >= 0
171174

172175
/** Is a implicit function name
173-
* - ImplicitFunctionN for N >= 0
176+
* - ImplicitFunctionN for N >= 1
174177
* - false otherwise
175178
*/
176-
def isImplicitFunction: Boolean = functionArityFor(str.ImplicitFunction) >= 0
179+
def isImplicitFunction: Boolean = functionArityFor(str.ImplicitFunction) >= 1
177180

178181
/** Is a synthetic function name
179182
* - FunctionN for N > 22
180-
* - ImplicitFunctionN for N >= 0
183+
* - ImplicitFunctionN for N >= 1
181184
* - false otherwise
182185
*/
183186
def isSyntheticFunction: Boolean = {
184187
functionArityFor(str.Function) > MaxImplementedFunctionArity ||
185-
functionArityFor(str.ImplicitFunction) >= 0
188+
functionArityFor(str.ImplicitFunction) >= 1
186189
}
187190

188191
/** Parsed function arity for function with some specific prefix */

0 commit comments

Comments
 (0)