@@ -329,25 +329,13 @@ def addPreDefinitions (docCtx : LocalContext × LocalInstances) (preDefs : Array
329329 else if preDefs.any (·.modifiers.isUnsafe) then
330330 addAndCompileUnsafe docCtx preDefs
331331 preDefs.forM (·.termination.ensureNone "unsafe" )
332+ else if preDefs.any (·.modifiers.isPartial) then
333+ for preDef in preDefs do
334+ if preDef.modifiers.isPartial && !(← whnfD preDef.type).isForall then
335+ withRef preDef.ref <| throwError "invalid use of 'partial', '{preDef.declName}' is not a function{indentExpr preDef.type}"
336+ addAndCompilePartial docCtx preDefs
337+ preDefs.forM (·.termination.ensureNone "partial" )
332338 else
333- -- Consider partial if `partial` was given explicitly, or implied and no termination hint
334- -- was given
335- if preDefs.any (·.modifiers.isPartial) ||
336- preDefs.any (·.modifiers.isInferredPartial) && !preDefs.any (·.termination.isNotNone) then
337- let mut isPartial := true
338- for preDef in preDefs do
339- if !(← whnfD preDef.type).isForall then
340- if preDef.modifiers.isPartial then
341- withRef preDef.ref <| throwError "invalid use of `partial`, `{preDef.declName}` is not a function{indentExpr preDef.type}"
342- else
343- -- `meta` should not imply `partial` in this case
344- isPartial := false
345-
346- if isPartial then
347- addAndCompilePartial docCtx preDefs
348- preDefs.forM (·.termination.ensureNone "partial" )
349- continue
350-
351339 ensureFunIndReservedNamesAvailable preDefs
352340 try
353341 checkCodomainsLevel preDefs
0 commit comments