Skip to content

Commit 9e9059d

Browse files
committed
chore: adapt to leanprover/lean4#11587
1 parent 2fa5d6e commit 9e9059d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Qq/Macro.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ meta def isBad (e : Expr) : Bool := Id.run do
126126
return false
127127

128128
-- https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/How.20to.20WHNF.20without.20exposing.20recursors.3F/near/249743042
129-
meta def whnf (e : Expr) (e0 : Expr := e) : MetaM Expr := do
129+
meta partial def whnf (e : Expr) (e0 : Expr := e) : MetaM Expr := do
130130
let e ← whnfCore e
131131
let e0 := if isBad e then e0 else e
132132
match ← unfoldDefinition? e with
@@ -172,7 +172,7 @@ meta partial def unquoteLevelMVar (mvar : Expr) : UnquoteM Level := do
172172

173173
end
174174

175-
meta def unquoteLevelList (e : Expr) : UnquoteM (List Level) := do
175+
meta partial def unquoteLevelList (e : Expr) : UnquoteM (List Level) := do
176176
let e ← whnf e
177177
if e.isAppOfArity ``List.nil 1 then
178178
pure []
@@ -217,7 +217,7 @@ meta def makeDefEq (a b : Expr) : MetaM (Option LocalContext) := do
217217

218218
mutual
219219

220-
meta def unquoteExprList (e : Expr) : UnquoteM (List Expr) := do
220+
meta partial def unquoteExprList (e : Expr) : UnquoteM (List Expr) := do
221221
let e ← whnf e
222222
if e.isAppOfArity ``List.nil 1 then
223223
pure []
@@ -226,7 +226,7 @@ meta def unquoteExprList (e : Expr) : UnquoteM (List Expr) := do
226226
else
227227
throwFailedToEval e
228228

229-
meta def unquoteExprMVar (mvar : Expr) : UnquoteM Expr := do
229+
meta partial def unquoteExprMVar (mvar : Expr) : UnquoteM Expr := do
230230
let ty ← instantiateMVars (← whnfR (← inferType mvar))
231231
unless ty.isAppOf ``Quoted do throwError "not of type Q(_):{indentExpr ty}"
232232
have et := ty.getArg! 0
@@ -239,7 +239,7 @@ meta def unquoteExprMVar (mvar : Expr) : UnquoteM Expr := do
239239
}
240240
return newMVar
241241

242-
meta def unquoteExpr (e : Expr) : UnquoteM Expr := do
242+
meta partial def unquoteExpr (e : Expr) : UnquoteM Expr := do
243243
if e.isAppOfArity ``Quoted.unsafeMk 2 then return ← unquoteExpr (e.getArg! 1)
244244
if e.isAppOfArity ``toExpr 3 then return e.getArg! 2
245245
let e ← instantiateMVars (← whnf e)
@@ -388,7 +388,7 @@ meta def quoteLevelList : List Level → QuoteM Expr
388388
return mkApp3 (.const ``List.cons [.zero]) (.const ``Level [])
389389
(← quoteLevel l) (← quoteLevelList ls)
390390

391-
meta def quoteExpr : Expr → QuoteM Expr
391+
meta partial def quoteExpr : Expr → QuoteM Expr
392392
| .bvar i => return mkApp (.const ``Expr.bvar []) (toExpr i)
393393
| e@(.fvar ..) => do
394394
let some r := (← read).exprBackSubst[e]? | throwError "unknown free variable {e}"
@@ -613,7 +613,7 @@ support `Q($(foo) ∨ False)`
613613
private meta def push [Monad m] (i t l : Syntax) : StateT (Array $ Syntax × Syntax × Syntax) m Unit :=
614614
modify fun s => s.push (i, t, l)
615615

616-
meta def floatLevelAntiquot' [Monad m] [MonadQuotation m] (stx : Syntax) :
616+
meta partial def floatLevelAntiquot' [Monad m] [MonadQuotation m] (stx : Syntax) :
617617
StateT (Array $ Syntax × Syntax × Syntax) m Syntax :=
618618
if stx.isAntiquot && !stx.isEscapedAntiquot then
619619
withFreshMacroScope do
@@ -625,7 +625,7 @@ meta def floatLevelAntiquot' [Monad m] [MonadQuotation m] (stx : Syntax) :
625625
| stx => return stx
626626

627627
open TSyntax.Compat in
628-
meta def floatExprAntiquot' [Monad m] [MonadQuotation m] (depth : Nat) :
628+
meta partial def floatExprAntiquot' [Monad m] [MonadQuotation m] (depth : Nat) :
629629
Syntax → StateT (Array $ Syntax × Syntax × Syntax) m Syntax
630630
| `(Q($x)) => do `(Q($(← floatExprAntiquot' (depth + 1) x)))
631631
| `(q($x)) => do `(q($(← floatExprAntiquot' (depth + 1) x)))

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:nightly-2025-12-02
1+
leanprover/lean4-pr-releases:pr-release-11587-3a37d68

0 commit comments

Comments
 (0)