@@ -199,7 +199,7 @@ object NameOps {
199199 else collectDigits(acc * 10 + d, idx + 1 )
200200 collectDigits(0 , suffixStart + 8 )
201201
202- private def isFunctionPrefix (suffixStart : Int , mustHave : String = " " ): Boolean =
202+ private def isFunctionPrefix (suffixStart : Int , mustHave : String = " " )( using Context ) : Boolean =
203203 suffixStart >= 0
204204 && {
205205 val first = name.firstPart
@@ -209,47 +209,49 @@ object NameOps {
209209 if str == mustHave then found = true
210210 idx + str.length
211211 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
213214 && found
214215 }
215216
216217 /** 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).
218220 */
219- private def checkedFunArity (suffixStart : Int ): Int =
221+ private def checkedFunArity (suffixStart : Int )( using Context ) : Int =
220222 if isFunctionPrefix(suffixStart) then funArity(suffixStart) else - 1
221223
222224 /** Is a function name, i.e one of FunctionXXL, FunctionN, ContextFunctionN, ErasedFunctionN, ErasedContextFunctionN for N >= 0
223225 */
224- def isFunction : Boolean =
226+ def isFunction ( using Context ) : Boolean =
225227 (name eq tpnme.FunctionXXL ) || checkedFunArity(functionSuffixStart) >= 0
226228
227229 /** Is a function name
228230 * - FunctionN for N >= 0
229231 */
230- def isPlainFunction : Boolean = functionArity >= 0
232+ def isPlainFunction ( using Context ) : Boolean = functionArity >= 0
231233
232234 /** 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 =
234236 val suffixStart = functionSuffixStart
235237 isFunctionPrefix(suffixStart, mustHave) && funArity(suffixStart) >= 0
236238
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" )
240242
241243 /** Is a synthetic function name, i.e. one of
242244 * - FunctionN for N > 22
243245 * - ContextFunctionN for N >= 0
244246 * - ErasedFunctionN for N >= 0
245247 * - ErasedContextFunctionN for N >= 0
246248 */
247- def isSyntheticFunction : Boolean =
249+ def isSyntheticFunction ( using Context ) : Boolean =
248250 val suffixStart = functionSuffixStart
249251 if suffixStart == 0 then funArity(suffixStart) > MaxImplementedFunctionArity
250252 else checkedFunArity(suffixStart) >= 0
251253
252- def functionArity : Int =
254+ def functionArity ( using Context ) : Int =
253255 val suffixStart = functionSuffixStart
254256 if suffixStart >= 0 then checkedFunArity(suffixStart) else - 1
255257
0 commit comments