Skip to content

Commit

Permalink
Update NameOps to disregard ImplicitFuncion0 as a function name
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jun 1, 2017
1 parent cf346d4 commit 9ea9bf5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions compiler/src/dotty/tools/dotc/core/NameOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,36 @@ object NameOps {

/** Is a synthetic function name
* - N for FunctionN
* - N for ImplicitFunctionN
* - N for ImplicitFunctionN (N >= 1)
* - (-1) otherwise
*/
def functionArity: Int =
functionArityFor(str.Function) max functionArityFor(str.ImplicitFunction)
functionArityFor(str.Function) max {
val n = functionArityFor(str.ImplicitFunction)
if (n == 0) -1 else n
}

/** Is a function name
* - FunctionN for N >= 0
* - ImplicitFunctionN for N >= 0
* - ImplicitFunctionN for N >= 1
* - false otherwise
*/
def isFunction: Boolean = functionArity >= 0

/** Is a implicit function name
* - ImplicitFunctionN for N >= 0
* - ImplicitFunctionN for N >= 1
* - false otherwise
*/
def isImplicitFunction: Boolean = functionArityFor(str.ImplicitFunction) >= 0
def isImplicitFunction: Boolean = functionArityFor(str.ImplicitFunction) >= 1

/** Is a synthetic function name
* - FunctionN for N > 22
* - ImplicitFunctionN for N >= 0
* - ImplicitFunctionN for N >= 1
* - false otherwise
*/
def isSyntheticFunction: Boolean = {
functionArityFor(str.Function) > MaxImplementedFunctionArity ||
functionArityFor(str.ImplicitFunction) >= 0
functionArityFor(str.ImplicitFunction) >= 1
}

/** Parsed function arity for function with some specific prefix */
Expand Down

0 comments on commit 9ea9bf5

Please sign in to comment.