@@ -199,7 +199,7 @@ object NameOps {
199
199
else collectDigits(acc * 10 + d, idx + 1 )
200
200
collectDigits(0 , suffixStart + 8 )
201
201
202
- private def isFunctionPrefix (suffixStart : Int , mustHave : String = " " ): Boolean =
202
+ private def isFunctionPrefix (suffixStart : Int , mustHave : String = " " )( using Context ) : Boolean =
203
203
suffixStart >= 0
204
204
&& {
205
205
val first = name.firstPart
@@ -209,47 +209,49 @@ object NameOps {
209
209
if str == mustHave then found = true
210
210
idx + str.length
211
211
else idx
212
- skip(skip(skip(0 , " Impure" ), " Erased" ), " Context" ) == suffixStart
212
+ val start = if ctx.settings.Ycc .value then skip(0 , " Impure" ) else 0
213
+ skip(skip(start, " Erased" ), " Context" ) == suffixStart
213
214
&& found
214
215
}
215
216
216
217
/** Same as `funArity`, except that it returns -1 if the prefix
217
- * is not one of "", "Context", "Erased", "ErasedContext"
218
+ * is not one of a (possibly empty) concatenation of a subset of
219
+ * "Impure" (only under -Ycc), "Erased" and "Context" (in that order).
218
220
*/
219
- private def checkedFunArity (suffixStart : Int ): Int =
221
+ private def checkedFunArity (suffixStart : Int )( using Context ) : Int =
220
222
if isFunctionPrefix(suffixStart) then funArity(suffixStart) else - 1
221
223
222
224
/** Is a function name, i.e one of FunctionXXL, FunctionN, ContextFunctionN, ErasedFunctionN, ErasedContextFunctionN for N >= 0
223
225
*/
224
- def isFunction : Boolean =
226
+ def isFunction ( using Context ) : Boolean =
225
227
(name eq tpnme.FunctionXXL ) || checkedFunArity(functionSuffixStart) >= 0
226
228
227
229
/** Is a function name
228
230
* - FunctionN for N >= 0
229
231
*/
230
- def isPlainFunction : Boolean = functionArity >= 0
232
+ def isPlainFunction ( using Context ) : Boolean = functionArity >= 0
231
233
232
234
/** Is a function name that contains `mustHave` as a substring */
233
- private def isSpecificFunction (mustHave : String ): Boolean =
235
+ private def isSpecificFunction (mustHave : String )( using Context ) : Boolean =
234
236
val suffixStart = functionSuffixStart
235
237
isFunctionPrefix(suffixStart, mustHave) && funArity(suffixStart) >= 0
236
238
237
- def isContextFunction : Boolean = isSpecificFunction(" Context" )
238
- def isErasedFunction : Boolean = isSpecificFunction(" Erased" )
239
- def isImpureFunction : Boolean = isSpecificFunction(" Impure" )
239
+ def isContextFunction ( using Context ) : Boolean = isSpecificFunction(" Context" )
240
+ def isErasedFunction ( using Context ) : Boolean = isSpecificFunction(" Erased" )
241
+ def isImpureFunction ( using Context ) : Boolean = isSpecificFunction(" Impure" )
240
242
241
243
/** Is a synthetic function name, i.e. one of
242
244
* - FunctionN for N > 22
243
245
* - ContextFunctionN for N >= 0
244
246
* - ErasedFunctionN for N >= 0
245
247
* - ErasedContextFunctionN for N >= 0
246
248
*/
247
- def isSyntheticFunction : Boolean =
249
+ def isSyntheticFunction ( using Context ) : Boolean =
248
250
val suffixStart = functionSuffixStart
249
251
if suffixStart == 0 then funArity(suffixStart) > MaxImplementedFunctionArity
250
252
else checkedFunArity(suffixStart) >= 0
251
253
252
- def functionArity : Int =
254
+ def functionArity ( using Context ) : Int =
253
255
val suffixStart = functionSuffixStart
254
256
if suffixStart >= 0 then checkedFunArity(suffixStart) else - 1
255
257
0 commit comments