diff --git a/src/Init/Prelude.lean b/src/Init/Prelude.lean index 87e65df98c..46ea717d3f 100644 --- a/src/Init/Prelude.lean +++ b/src/Init/Prelude.lean @@ -4082,7 +4082,7 @@ Actions in the resulting monad are functions that take the local value as a para ordinary actions in `m`. -/ def ReaderT (ρ : Type u) (m : Type u → Type v) (α : Type u) : Type (max u v) := - ρ → m α + (a : @&ρ) → m α /-- Interpret `ρ → m α` as an element of `ReaderT ρ m α`. diff --git a/src/Lean/Compiler/IR/AddExtern.lean b/src/Lean/Compiler/IR/AddExtern.lean index aa9db32b7c..4e08925d86 100644 --- a/src/Lean/Compiler/IR/AddExtern.lean +++ b/src/Lean/Compiler/IR/AddExtern.lean @@ -21,6 +21,7 @@ public section namespace Lean.IR +set_option compiler.ignoreBorrowAnnotation true in @[export lean_add_extern] def addExtern (declName : Name) (externAttrData : ExternAttrData) : CoreM Unit := do if !isPrivateName declName then diff --git a/src/Lean/Elab/PreDefinition/Structural/Eqns.lean b/src/Lean/Elab/PreDefinition/Structural/Eqns.lean index 4e0f152ac1..eec3c73161 100644 --- a/src/Lean/Elab/PreDefinition/Structural/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/Structural/Eqns.lean @@ -184,6 +184,7 @@ def getUnfoldFor? (declName : Name) : MetaM (Option Name) := do else return none +set_option compiler.ignoreBorrowAnnotation true in @[export lean_get_structural_rec_arg_pos] def getStructuralRecArgPosImp? (declName : Name) : CoreM (Option Nat) := do let some info := eqnInfoExt.find? (← getEnv) declName | return none diff --git a/src/Lean/Elab/Tactic/Try.lean b/src/Lean/Elab/Tactic/Try.lean index d61fb08a11..a814b79f4d 100644 --- a/src/Lean/Elab/Tactic/Try.lean +++ b/src/Lean/Elab/Tactic/Try.lean @@ -787,6 +787,7 @@ where throw ex -- `evalSuggest` implementation +set_option compiler.ignoreBorrowAnnotation true in @[export lean_eval_suggest_tactic] private partial def evalSuggestImpl : TryTactic := fun tac => do trace[try.debug] "{tac}" diff --git a/src/Lean/Meta/ExprDefEq.lean b/src/Lean/Meta/ExprDefEq.lean index 790ed93784..0f2e7395e8 100644 --- a/src/Lean/Meta/ExprDefEq.lean +++ b/src/Lean/Meta/ExprDefEq.lean @@ -1126,6 +1126,7 @@ def checkAssignment (mvarId : MVarId) (fvars : Array Expr) (v : Expr) : MetaM (O return none return some v +set_option compiler.ignoreBorrowAnnotation true in -- Implementation for `_root_.Lean.MVarId.checkedAssign` @[export lean_checked_assign] def checkedAssignImpl (mvarId : MVarId) (val : Expr) : MetaM Bool := do @@ -2233,6 +2234,7 @@ private def whnfCoreAtDefEq (e : Expr) : MetaM Expr := do else whnfCore e +set_option compiler.ignoreBorrowAnnotation true in @[export lean_is_expr_def_eq] partial def isExprDefEqAuxImpl (t : Expr) (s : Expr) : MetaM Bool := withIncRecDepth do withTraceNodeBefore `Meta.isDefEq (fun _ => return m!"{t} =?= {s}") do diff --git a/src/Lean/Meta/InferType.lean b/src/Lean/Meta/InferType.lean index a2b70cbbe9..eb82f2bca2 100644 --- a/src/Lean/Meta/InferType.lean +++ b/src/Lean/Meta/InferType.lean @@ -206,6 +206,7 @@ because it overrides unrelated configurations. else withConfig (fun cfg => { cfg with beta := true, iota := true, zeta := true, zetaHave := true, zetaDelta := true, proj := .yesWithDelta, etaStruct := .all }) x +set_option compiler.ignoreBorrowAnnotation true in @[export lean_infer_type] def inferTypeImp (e : Expr) : MetaM Expr := let rec infer (e : Expr) : MetaM Expr := do diff --git a/src/Lean/Meta/LevelDefEq.lean b/src/Lean/Meta/LevelDefEq.lean index c9935288a5..4ca0e1d9fc 100644 --- a/src/Lean/Meta/LevelDefEq.lean +++ b/src/Lean/Meta/LevelDefEq.lean @@ -85,6 +85,7 @@ private def isMVarWithGreaterDepth (v : Level) (mvarId : LMVarId) : MetaM Bool : | Level.mvar mvarId' => return (← mvarId'.getLevel) > (← mvarId.getLevel) | _ => return false +set_option compiler.ignoreBorrowAnnotation true in mutual private partial def solve (u v : Level) : MetaM LBool := do diff --git a/src/Lean/Meta/Match/MatchEqs.lean b/src/Lean/Meta/Match/MatchEqs.lean index 251b575fce..3b7c7745a1 100644 --- a/src/Lean/Meta/Match/MatchEqs.lean +++ b/src/Lean/Meta/Match/MatchEqs.lean @@ -138,6 +138,7 @@ Creates conditional equations and splitter for the given match auxiliary declara See also `getEquationsFor`. -/ +set_option compiler.ignoreBorrowAnnotation true in @[export lean_get_match_equations_for] def getEquationsForImpl (matchDeclName : Name) : MetaM MatchEqns := do /- @@ -246,6 +247,7 @@ where go baseName splitterName := withConfig (fun c => { c with etaStruct := .no let result := { eqnNames, splitterName, splitterMatchInfo } registerMatchEqns matchDeclName result +set_option compiler.ignoreBorrowAnnotation true in /-- Generate the congruence equations for the given match auxiliary declaration. The congruence equations have a completely unrestricted left-hand side (arbitrary discriminants), diff --git a/src/Lean/Meta/Sym/Pattern.lean b/src/Lean/Meta/Sym/Pattern.lean index d7a4ae0fe9..2d67a4c1f8 100644 --- a/src/Lean/Meta/Sym/Pattern.lean +++ b/src/Lean/Meta/Sym/Pattern.lean @@ -785,6 +785,7 @@ def isDefEqApp (tFn : Expr) (t : Expr) (s : Expr) (_ : tFn = t.getAppFn) : DefEq let numArgs := t.getAppNumArgs isDefEqAppWithInfo t s (numArgs - 1) info +set_option compiler.ignoreBorrowAnnotation true in /-- `isDefEqMain` implementation. -/ diff --git a/src/Lean/Meta/Sym/Simp/Main.lean b/src/Lean/Meta/Sym/Simp/Main.lean index ce2146ab93..39cb34fe30 100644 --- a/src/Lean/Meta/Sym/Simp/Main.lean +++ b/src/Lean/Meta/Sym/Simp/Main.lean @@ -40,6 +40,7 @@ abbrev cacheResult (e : Expr) (r : Result) : SimpM Result := do modify fun s => { s with persistentCache := s.persistentCache.insert { expr := e } r } return r +set_option compiler.ignoreBorrowAnnotation true in @[export lean_sym_simp] def simpImpl (e₁ : Expr) : SimpM Result := withIncRecDepth do let numSteps := (← get).numSteps diff --git a/src/Lean/Meta/SynthInstance.lean b/src/Lean/Meta/SynthInstance.lean index a8be6ec596..76220bcc48 100644 --- a/src/Lean/Meta/SynthInstance.lean +++ b/src/Lean/Meta/SynthInstance.lean @@ -944,6 +944,7 @@ def synthInstance (type : Expr) (maxResultSize? : Option Nat := none) : MetaM Ex | none => throwFailedToSynthesize type) (fun _ => throwFailedToSynthesize type) +set_option compiler.ignoreBorrowAnnotation true in @[export lean_synth_pending] private def synthPendingImp (mvarId : MVarId) : MetaM Bool := withIncRecDepth <| mvarId.withContext do let mvarDecl ← mvarId.getDecl diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean index f8fc4edc4b..c2acb55a58 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean @@ -276,6 +276,7 @@ private def propagateNonlinearPow (x : Var) : GoalM Bool := do c'.assert return true +set_option compiler.ignoreBorrowAnnotation true in @[export lean_cutsat_propagate_nonlinear] def propagateNonlinearTermImpl (y : Var) (x : Var) : GoalM Bool := do unless (← isVarEqConst? y).isSome do return false @@ -338,6 +339,7 @@ partial def _root_.Int.Linear.Poly.updateOccsForElimEq (p : Poly) (x : Var) : Go go p go p +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_cutsat_assert_eq] def EqCnstr.assertImpl (c : EqCnstr) : GoalM Unit := do if (← inconsistent) then return () diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean index 2e66842145..120b6ce28b 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean @@ -99,6 +99,7 @@ where return some { p := c.p.addConst 1, h := .ofLeDiseq c c' } return none +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_cutsat_assert_le] def LeCnstr.assertImpl (c : LeCnstr) : GoalM Unit := do if (← inconsistent) then return () diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean index b8a1fa3771..d1ab3c19f7 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean @@ -325,7 +325,9 @@ private def mkPowEqProof (ka : Int) (ca? : Option EqCnstr) (kb : Nat) (cb? : Opt let h := mkApp8 (mkConst ``Int.Linear.pow_eq) a b (toExpr ka) (toExpr kbInt) (toExpr k) h₁ h₂ eagerReflBoolTrue return mkApp6 (mkConst ``Int.Linear.of_var_eq) (← getContext) (← mkVarDecl x) (toExpr k) (← mkPolyDecl c'.p) eagerReflBoolTrue h +set_option compiler.ignoreBorrowAnnotation true in mutual + @[export lean_cutsat_eq_cnstr_to_proof] private partial def EqCnstr.toExprProofImpl (c' : EqCnstr) : ProofM Expr := caching c' do trace[grind.debug.lia.proof] "{← c'.pp}" diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean index b963dcdda3..e1c281796c 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean @@ -64,6 +64,7 @@ where registerNonlinearOcc e x | _ => registerNonlinearOcc e x +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_cutsat_mk_var] def mkVarImpl (expr : Expr) : GoalM Var := do if let some var := (← get').varMap.find? { expr } then diff --git a/src/Lean/Meta/Tactic/Grind/Canon.lean b/src/Lean/Meta/Tactic/Grind/Canon.lean index 9cfe6e3960..e245d9f793 100644 --- a/src/Lean/Meta/Tactic/Grind/Canon.lean +++ b/src/Lean/Meta/Tactic/Grind/Canon.lean @@ -239,6 +239,7 @@ private def normOfNatArgs? (args : Array Expr) : MetaM (Option (Array Expr)) := return some args.toArray return none +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_canon] partial def canonImpl (e : Expr) : GoalM Expr := do profileitM Exception "grind canon" (← getOptions) do trace_goal[grind.debug.canon] "{e}" diff --git a/src/Lean/Meta/Tactic/Grind/Core.lean b/src/Lean/Meta/Tactic/Grind/Core.lean index 23529f052a..bf4b53bc27 100644 --- a/src/Lean/Meta/Tactic/Grind/Core.lean +++ b/src/Lean/Meta/Tactic/Grind/Core.lean @@ -348,6 +348,7 @@ where internalize rhs generation p addEqCore lhs rhs proof isHEq +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_process_new_facts] private def processNewFactsImpl : GoalM Unit := do repeat diff --git a/src/Lean/Meta/Tactic/Grind/Internalize.lean b/src/Lean/Meta/Tactic/Grind/Internalize.lean index 7f0412a92f..df8aae0abb 100644 --- a/src/Lean/Meta/Tactic/Grind/Internalize.lean +++ b/src/Lean/Meta/Tactic/Grind/Internalize.lean @@ -535,6 +535,7 @@ private def internalizeOfNatFinBitVecLiteral (e : Expr) (generation : Nat) (pare updateIndicesFound (.const ``OfNat.ofNat) activateTheorems ``OfNat.ofNat generation +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_internalize] private partial def internalizeImpl (e : Expr) (generation : Nat) (parent? : Option Expr := none) : GoalM Unit := withIncRecDepth do if (← alreadyInternalized e) then diff --git a/src/Lean/Meta/Tactic/Grind/Proof.lean b/src/Lean/Meta/Tactic/Grind/Proof.lean index 73a6f5f56a..8f7f38f5ea 100644 --- a/src/Lean/Meta/Tactic/Grind/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Proof.lean @@ -328,6 +328,7 @@ mutual end +set_option compiler.ignoreBorrowAnnotation true in /-- Returns a proof that `a = b`. It assumes `a` and `b` are in the same equivalence class. @@ -338,6 +339,7 @@ def mkEqProofImpl (a b : Expr) : GoalM Expr := do throwError "internal `grind` error, `mkEqProof` invoked with terms of different types{indentExpr a}\nhas type{indentExpr (← inferType a)}\nbut{indentExpr b}\nhas type{indentExpr (← inferType b)}" mkEqProofCore a b (heq := false) +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_mk_heq_proof] def mkHEqProofImpl (a b : Expr) : GoalM Expr := mkEqProofCore a b (heq := true) diff --git a/src/Lean/Meta/Tactic/Grind/Simp.lean b/src/Lean/Meta/Tactic/Grind/Simp.lean index e88be35749..309563b89d 100644 --- a/src/Lean/Meta/Tactic/Grind/Simp.lean +++ b/src/Lean/Meta/Tactic/Grind/Simp.lean @@ -42,6 +42,7 @@ def dsimpCore (e : Expr) : GrindM Expr := do profileitM Exception "grind dsimp" modify fun s => { s with simp } return r +set_option compiler.ignoreBorrowAnnotation true in /-- Preprocesses `e` using `grind` normalization theorems and simprocs, and then applies several other preprocessing steps. diff --git a/src/Lean/Meta/Tactic/Grind/SimpUtil.lean b/src/Lean/Meta/Tactic/Grind/SimpUtil.lean index 7dd198d62c..264539ea7f 100644 --- a/src/Lean/Meta/Tactic/Grind/SimpUtil.lean +++ b/src/Lean/Meta/Tactic/Grind/SimpUtil.lean @@ -202,6 +202,7 @@ protected def getSimpContext (config : Grind.Config) : MetaM Simp.Context := do (simpTheorems := #[thms]) (congrTheorems := (← getSimpCongrTheorems)) +set_option compiler.ignoreBorrowAnnotation true in @[export lean_grind_normalize] def normalizeImp (e : Expr) (config : Grind.Config) : MetaM Expr := do let (r, _) ← Meta.simp e (← Grind.getSimpContext config) (← Grind.getSimprocs) diff --git a/src/Lean/Meta/Tactic/Simp/Main.lean b/src/Lean/Meta/Tactic/Simp/Main.lean index ee034ab9ce..f8c2607a24 100644 --- a/src/Lean/Meta/Tactic/Simp/Main.lean +++ b/src/Lean/Meta/Tactic/Simp/Main.lean @@ -512,6 +512,7 @@ Auxiliary `dsimproc` for not visiting `Char` literal subterms. -/ private def doNotVisitCharLit : DSimproc := doNotVisit isCharLit ``Char.ofNat +set_option compiler.ignoreBorrowAnnotation true in @[export lean_dsimp] private partial def dsimpImpl (e : Expr) : SimpM Expr := do let cfg ← getConfig @@ -710,6 +711,7 @@ where r ← r.mkEqTrans (← simpLoop r.expr) cacheResult e cfg r +set_option compiler.ignoreBorrowAnnotation true in @[export lean_simp] def simpImpl (e : Expr) : SimpM Result := withIncRecDepth do checkSystem "simp" diff --git a/src/Lean/Meta/WHNF.lean b/src/Lean/Meta/WHNF.lean index 471e43b4fa..74fcfef37f 100644 --- a/src/Lean/Meta/WHNF.lean +++ b/src/Lean/Meta/WHNF.lean @@ -1100,6 +1100,7 @@ private def cache (useCache : Bool) (e r : Expr) : MetaM Expr := do modify fun s => { s with cache.whnf := s.cache.whnf.insert key r } return r +set_option compiler.ignoreBorrowAnnotation true in @[export lean_whnf] partial def whnfImp (e : Expr) : MetaM Expr := withIncRecDepth <| whnfEasyCases e fun e => do diff --git a/src/Lean/Parser.lean b/src/Lean/Parser.lean index 00aa0d9992..931c55b498 100644 --- a/src/Lean/Parser.lean +++ b/src/Lean/Parser.lean @@ -65,6 +65,7 @@ end Parser namespace PrettyPrinter namespace Parenthesizer +set_option compiler.ignoreBorrowAnnotation true in -- Close the mutual recursion loop; see corresponding `[extern]` in the parenthesizer. @[export lean_mk_antiquot_parenthesizer] def mkAntiquot.parenthesizer (name : String) (kind : SyntaxNodeKind) (anonymous := true) (isPseudoKind := true) : Parenthesizer := @@ -80,6 +81,7 @@ def mkAntiquot.parenthesizer (name : String) (kind : SyntaxNodeKind) (anonymous open Lean.Parser +set_option compiler.ignoreBorrowAnnotation true in @[export lean_pretty_printer_parenthesizer_interpret_parser_descr] unsafe def interpretParserDescr : ParserDescr → CoreM Parenthesizer | ParserDescr.const n => getConstAlias parenthesizerAliasesRef n @@ -101,6 +103,7 @@ end Parenthesizer namespace Formatter +set_option compiler.ignoreBorrowAnnotation true in @[export lean_mk_antiquot_formatter] def mkAntiquot.formatter (name : String) (kind : SyntaxNodeKind) (anonymous := true) (isPseudoKind := true) : Formatter := Parser.mkAntiquot.formatter name kind anonymous isPseudoKind @@ -113,6 +116,7 @@ def mkAntiquot.formatter (name : String) (kind : SyntaxNodeKind) (anonymous := t open Lean.Parser +set_option compiler.ignoreBorrowAnnotation true in @[export lean_pretty_printer_formatter_interpret_parser_descr] unsafe def interpretParserDescr : ParserDescr → CoreM Formatter | ParserDescr.const n => getConstAlias formatterAliasesRef n diff --git a/stage0/src/stdlib_flags.h b/stage0/src/stdlib_flags.h index e444447049..b4202aa74a 100644 --- a/stage0/src/stdlib_flags.h +++ b/stage0/src/stdlib_flags.h @@ -11,7 +11,7 @@ options get_default_options() { opts = opts.update({"debug", "terminalTacticsAsSorry"}, false); // switch to `true` for ABI-breaking changes affecting meta code; // see also next option! - opts = opts.update({"interpreter", "prefer_native"}, false); + opts = opts.update({"interpreter", "prefer_native"}, true); // switch to `false` when enabling `prefer_native` should also affect use // of built-in parsers in quotations; this is usually the case, but setting // both to `true` may be necessary for handling non-builtin parsers with diff --git a/tests/elab/Reparen.lean.out.expected b/tests/elab/Reparen.lean.out.expected index c2a7c1934d..8fcef768f5 100644 --- a/tests/elab/Reparen.lean.out.expected +++ b/tests/elab/Reparen.lean.out.expected @@ -4028,7 +4028,7 @@ Actions in the resulting monad are functions that take the local value as a para ordinary actions in `m`. -/ def ReaderT (ρ : Type u) (m : Type u → Type v) (α : Type u) : Type max u v := - ρ → m α + (a : @&ρ) → m α /-- Interpret `ρ → m α` as an element of `ReaderT ρ m α`. diff --git a/tests/elab/attachJp.lean.out.expected b/tests/elab/attachJp.lean.out.expected index 1b00bafaf7..de88647a95 100644 --- a/tests/elab/attachJp.lean.out.expected +++ b/tests/elab/attachJp.lean.out.expected @@ -71,98 +71,98 @@ let _x.4 := Nat.decEq x _x.3; return _x.4 [Compiler.simp] size: 12 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := @Array.mkEmpty _ _x.6; - let _x.8 := @Array.push _ _x.7 _x.5; - let _x.9 := PUnit.unit; - fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit := - let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17; - cases _x.18 : EST.Out Lean.Exception lcAny PUnit - | EST.Out.ok a.19 a.20 => - let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20; - return _x.21 - | EST.Out.error a.22 a.23 => - return _x.18; - let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3; - return _x.24 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := @Array.mkEmpty _ _x.4; + let _x.6 := @Array.push _ _x.5 _x.3; + let _x.7 := PUnit.unit; + fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit := + let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15; + cases _x.16 : EST.Out Lean.Exception lcAny PUnit + | EST.Out.ok a.17 a.18 => + let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18; + return _x.19 + | EST.Out.error a.20 a.21 => + return _x.16; + let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1; + return _x.22 [Compiler.simp] size: 12 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := @Array.mkEmpty _ _x.6; - let _x.8 := @Array.push _ _x.7 _x.5; - let _x.9 := PUnit.unit; - fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit := - let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17; - cases _x.18 : EST.Out Lean.Exception lcAny PUnit - | EST.Out.ok a.19 a.20 => - let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20; - return _x.21 - | EST.Out.error a.22 a.23 => - return _x.18; - let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3; - return _x.24 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := @Array.mkEmpty _ _x.4; + let _x.6 := @Array.push _ _x.5 _x.3; + let _x.7 := PUnit.unit; + fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit := + let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15; + cases _x.16 : EST.Out Lean.Exception lcAny PUnit + | EST.Out.ok a.17 a.18 => + let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18; + return _x.19 + | EST.Out.error a.20 a.21 => + return _x.16; + let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1; + return _x.22 [Compiler.simp] size: 12 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := @Array.mkEmpty _ _x.6; - let _x.8 := @Array.push _ _x.7 _x.5; - let _x.9 := PUnit.unit; - fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit := - let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17; - cases _x.18 : EST.Out Lean.Exception lcAny PUnit - | EST.Out.ok a.19 a.20 => - let _x.21 := @EST.Out.ok _ _ _ _x.9 a.20; - return _x.21 - | EST.Out.error a.22 a.23 => - return _x.18; - let _x.24 := @Lean.Elab.Command.liftTermElabM _ _f.10 a.1 a.2 a.3; - return _x.24 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := @Array.mkEmpty _ _x.4; + let _x.6 := @Array.push _ _x.5 _x.3; + let _x.7 := PUnit.unit; + fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit := + let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15; + cases _x.16 : EST.Out Lean.Exception lcAny PUnit + | EST.Out.ok a.17 a.18 => + let _x.19 := @EST.Out.ok _ _ _ _x.7 a.18; + return _x.19 + | EST.Out.error a.20 a.21 => + return _x.16; + let _x.22 := @Lean.Elab.Command.liftTermElabM _ _f.8 a a a.1; + return _x.22 [Compiler.simp] size: 12 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := Array.mkEmpty ◾ _x.6; - let _x.8 := Array.push ◾ _x.7 _x.5; - let _x.9 := PUnit.unit; - fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit := - let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17; - cases _x.18 : EST.Out Lean.Exception lcAny PUnit - | EST.Out.ok a.19 a.20 => - let _x.21 := @EST.Out.ok ◾ ◾ ◾ _x.9 a.20; - return _x.21 - | EST.Out.error a.22 a.23 => - return _x.18; - let _x.24 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3; - return _x.24 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := Array.mkEmpty ◾ _x.4; + let _x.6 := Array.push ◾ _x.5 _x.3; + let _x.7 := PUnit.unit; + fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit := + let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15; + cases _x.16 : EST.Out Lean.Exception lcAny PUnit + | EST.Out.ok a.17 a.18 => + let _x.19 := @EST.Out.ok ◾ ◾ ◾ _x.7 a.18; + return _x.19 + | EST.Out.error a.20 a.21 => + return _x.16; + let _x.22 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1; + return _x.22 [Compiler.simp] size: 12 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := Array.mkEmpty ◾ _x.6; - let _x.8 := Array.push ◾ _x.7 _x.5; - let _x.9 := PUnit.unit; - fun _f.10 _y.11 _y.12 _y.13 _y.14 _y.15 _y.16 _y.17 : EST.Out Lean.Exception lcAny PUnit := - let _x.18 := Lean.Compiler.compile _x.8 _y.15 _y.16 _y.17; - cases _x.18 : EST.Out Lean.Exception lcAny PUnit - | EST.Out.ok a.19 a.20 => - let _x.21 := @EST.Out.ok ◾ ◾ ◾ _x.9 a.20; - return _x.21 - | EST.Out.error a.22 a.23 => - return _x.18; - let _x.24 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3; - return _x.24 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := Array.mkEmpty ◾ _x.4; + let _x.6 := Array.push ◾ _x.5 _x.3; + let _x.7 := PUnit.unit; + fun _f.8 _y.9 @&_y.10 @&_y.11 @&_y.12 @&_y.13 @&_y.14 _y.15 : EST.Out Lean.Exception lcAny PUnit := + let _x.16 := Lean.Compiler.compile _x.6 _y.13 _y.14 _y.15; + cases _x.16 : EST.Out Lean.Exception lcAny PUnit + | EST.Out.ok a.17 a.18 => + let _x.19 := @EST.Out.ok ◾ ◾ ◾ _x.7 a.18; + return _x.19 + | EST.Out.error a.20 a.21 => + return _x.16; + let _x.22 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1; + return _x.22 [Compiler.simp] size: 5 - def _private.elab.attachJp.0._eval._lam_0 _x.1 _x.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 : EST.Out Lean.Exception - lcAny PUnit := + def _private.elab.attachJp.0._eval._lam_0 _x.1 _x.2 _y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 _y.9 : EST.Out + Lean.Exception lcAny PUnit := let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9; cases _x.10 : EST.Out Lean.Exception lcAny PUnit | EST.Out.ok a.11 a.12 => @@ -171,13 +171,13 @@ | EST.Out.error a.14 a.15 => return _x.10 [Compiler.simp] size: 8 - def _private.elab.attachJp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := Array.mkEmpty ◾ _x.6; - let _x.8 := Array.push ◾ _x.7 _x.5; - let _x.9 := PUnit.unit; - let _f.10 := _eval._lam_0 _x.8 _x.9; - let _x.11 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3; - return _x.11 + def _private.elab.attachJp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := Array.mkEmpty ◾ _x.4; + let _x.6 := Array.push ◾ _x.5 _x.3; + let _x.7 := PUnit.unit; + let _f.8 := _eval._lam_0 _x.6 _x.7; + let _x.9 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1; + return _x.9 diff --git a/tests/elab/casesOnSameCtor.lean b/tests/elab/casesOnSameCtor.lean index d4a73df23d..6034ecba32 100644 --- a/tests/elab/casesOnSameCtor.lean +++ b/tests/elab/casesOnSameCtor.lean @@ -136,7 +136,7 @@ namespace List -- No code is generated for the match_on_same_ctor or match_on_same_ctor.het /-- trace: [Compiler.saveMono] size: 5 - def _private.elab.casesOnSameCtor.0._eval._lam_0 _x.1 _x.2 _x.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 _y.10 : EST.Out + def _private.elab.casesOnSameCtor.0._eval._lam_0 _x.1 _x.2 _x.3 _y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 @&_y.9 _y.10 : EST.Out Exception lcAny PUnit := let _x.11 := mkCasesOnSameCtor _x.1 _x.2 _y.6 _y.7 _y.8 _y.9 _y.10; cases _x.11 : EST.Out Exception lcAny PUnit @@ -146,15 +146,15 @@ trace: [Compiler.saveMono] size: 5 | EST.Out.error a.15 a.16 => return _x.11 [Compiler.saveMono] size: 7 - def _private.elab.casesOnSameCtor.0._eval a.1 a.2 a.3 : EST.Out Exception lcAny PUnit := - let _x.4 := "List"; - let _x.5 := "match_on_same_ctor"; - let _x.6 := Name.mkStr2 _x.4 _x.5; - let _x.7 := Name.mkStr1 _x.4; - let _x.8 := PUnit.unit; - let _f.9 := _eval._lam_0 _x.6 _x.7 _x.8; - let _x.10 := Lean.Elab.Command.liftTermElabM._redArg _f.9 a.1 a.2 a.3; - return _x.10 + def _private.elab.casesOnSameCtor.0._eval @&a @&a a.1 : EST.Out Exception lcAny PUnit := + let _x.2 := "List"; + let _x.3 := "match_on_same_ctor"; + let _x.4 := Name.mkStr2 _x.2 _x.3; + let _x.5 := Name.mkStr1 _x.2; + let _x.6 := PUnit.unit; + let _f.7 := _eval._lam_0 _x.4 _x.5 _x.6; + let _x.8 := Lean.Elab.Command.liftTermElabM._redArg _f.7 a a a.1; + return _x.8 -/ #guard_msgs in set_option trace.Compiler.saveMono true in diff --git a/tests/elab/emptyLcnf.lean b/tests/elab/emptyLcnf.lean index 5e9caba70d..9ebbbbb362 100644 --- a/tests/elab/emptyLcnf.lean +++ b/tests/elab/emptyLcnf.lean @@ -12,8 +12,8 @@ trace: [Compiler.saveMono] size: 0 ⊥ --- trace: [Compiler.saveMono] size: 5 - def _private.elab.emptyLcnf.0._eval._lam_0 _x.1 _x.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 _y.9 : EST.Out Lean.Exception - lcAny PUnit := + def _private.elab.emptyLcnf.0._eval._lam_0 _x.1 _x.2 _y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 @&_y.8 _y.9 : EST.Out + Lean.Exception lcAny PUnit := let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9; cases _x.10 : EST.Out Lean.Exception lcAny PUnit | EST.Out.ok a.11 a.12 => @@ -22,16 +22,16 @@ trace: [Compiler.saveMono] size: 5 | EST.Out.error a.14 a.15 => return _x.10 [Compiler.saveMono] size: 8 - def _private.elab.emptyLcnf.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "f"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := Array.mkEmpty ◾ _x.6; - let _x.8 := Array.push ◾ _x.7 _x.5; - let _x.9 := PUnit.unit; - let _f.10 := _eval._lam_0 _x.8 _x.9; - let _x.11 := Lean.Elab.Command.liftTermElabM._redArg _f.10 a.1 a.2 a.3; - return _x.11 + def _private.elab.emptyLcnf.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "f"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := Array.mkEmpty ◾ _x.4; + let _x.6 := Array.push ◾ _x.5 _x.3; + let _x.7 := PUnit.unit; + let _f.8 := _eval._lam_0 _x.6 _x.7; + let _x.9 := Lean.Elab.Command.liftTermElabM._redArg _f.8 a a a.1; + return _x.9 -/ #guard_msgs in run_meta Lean.Compiler.compile #[``f] diff --git a/tests/elab/erased.lean b/tests/elab/erased.lean index 708ec3f0fd..a330550b04 100644 --- a/tests/elab/erased.lean +++ b/tests/elab/erased.lean @@ -27,7 +27,7 @@ trace: [Compiler.saveMono] size: 1 --- trace: [Compiler.saveMono] size: 5 def _private.elab.erased.0._eval._lam_0 (_x.1 : Array - Lean.Name) (_x.2 : PUnit) (_y.3 : Lean.Elab.Term.Context) (_y.4 : lcAny) (_y.5 : Lean.Meta.Context) (_y.6 : lcAny) (_y.7 : Lean.Core.Context) (_y.8 : lcAny) (_y.9 : lcVoid) : EST.Out + Lean.Name) (_x.2 : PUnit) (_y.3 : Lean.Elab.Term.Context) (_y.4 : @&lcAny) (_y.5 : @&Lean.Meta.Context) (_y.6 : @&lcAny) (_y.7 : @&Lean.Core.Context) (_y.8 : @&lcAny) (_y.9 : lcVoid) : EST.Out Lean.Exception lcAny PUnit := let _x.10 : EST.Out Lean.Exception lcAny PUnit := compile _x.1 _y.7 _y.8 _y.9; cases _x.10 : EST.Out Lean.Exception lcAny PUnit @@ -37,21 +37,21 @@ trace: [Compiler.saveMono] size: 5 | EST.Out.error (a.14 : Lean.Exception) (a.15 : lcVoid) => return _x.10 [Compiler.saveMono] size: 9 - def _private.elab.erased.0._eval (a.1 : Lean.Elab.Command.Context) (a.2 : lcAny) (a.3 : lcVoid) : EST.Out + def _private.elab.erased.0._eval (a : @&Lean.Elab.Command.Context) (a : @&lcAny) (a.1 : lcVoid) : EST.Out Lean.Exception lcAny PUnit := - let _x.4 : String := "Erased"; - let _x.5 : String := "mk"; - let _x.6 : Lean.Name := Lean.Name.mkStr2 _x.4 _x.5; - let _x.7 : Nat := 1; - let _x.8 : Array Lean.Name := Array.mkEmpty ◾ _x.7; - let _x.9 : Array Lean.Name := Array.push ◾ _x.8 _x.6; - let _x.10 : PUnit := PUnit.unit; - let _f.11 : Lean.Elab.Term.Context → + let _x.2 : String := "Erased"; + let _x.3 : String := "mk"; + let _x.4 : Lean.Name := Lean.Name.mkStr2 _x.2 _x.3; + let _x.5 : Nat := 1; + let _x.6 : Array Lean.Name := Array.mkEmpty ◾ _x.5; + let _x.7 : Array Lean.Name := Array.push ◾ _x.6 _x.4; + let _x.8 : PUnit := PUnit.unit; + let _f.9 : Lean.Elab.Term.Context → lcAny → Lean.Meta.Context → - lcAny → Lean.Core.Context → lcAny → lcVoid → EST.Out Lean.Exception lcAny PUnit := _eval._lam_0 _x.9 _x.10; - let _x.12 : EST.Out Lean.Exception lcAny PUnit := Lean.Elab.Command.liftTermElabM._redArg _f.11 a.1 a.2 a.3; - return _x.12 + lcAny → Lean.Core.Context → lcAny → lcVoid → EST.Out Lean.Exception lcAny PUnit := _eval._lam_0 _x.7 _x.8; + let _x.10 : EST.Out Lean.Exception lcAny PUnit := Lean.Elab.Command.liftTermElabM._redArg _f.9 a a a.1; + return _x.10 -/ #guard_msgs in run_meta Lean.Compiler.compile #[``Erased.mk] diff --git a/tests/elab/inlineApp.lean b/tests/elab/inlineApp.lean index de46be5951..1538164078 100644 --- a/tests/elab/inlineApp.lean +++ b/tests/elab/inlineApp.lean @@ -20,20 +20,20 @@ trace: [Compiler.saveMono] size: 8 return _x.8 --- trace: [Compiler.saveMono] size: 1 - def _private.elab.inlineApp.0._eval._lam_0 _x.1 _y.2 _y.3 _y.4 _y.5 _y.6 _y.7 _y.8 : EST.Out Lean.Exception lcAny - PUnit := + def _private.elab.inlineApp.0._eval._lam_0 _x.1 _y.2 @&_y.3 @&_y.4 @&_y.5 @&_y.6 @&_y.7 _y.8 : EST.Out + Lean.Exception lcAny PUnit := let _x.9 := Lean.Compiler.compile _x.1 _y.6 _y.7 _y.8; return _x.9 [Compiler.saveMono] size: 7 - def _private.elab.inlineApp.0._eval a.1 a.2 a.3 : EST.Out Lean.Exception lcAny PUnit := - let _x.4 := "h"; - let _x.5 := Lean.Name.mkStr1 _x.4; - let _x.6 := 1; - let _x.7 := Array.mkEmpty ◾ _x.6; - let _x.8 := Array.push ◾ _x.7 _x.5; - let _f.9 := _eval._lam_0 _x.8; - let _x.10 := Lean.Elab.Command.liftTermElabM._redArg _f.9 a.1 a.2 a.3; - return _x.10 + def _private.elab.inlineApp.0._eval @&a @&a a.1 : EST.Out Lean.Exception lcAny PUnit := + let _x.2 := "h"; + let _x.3 := Lean.Name.mkStr1 _x.2; + let _x.4 := 1; + let _x.5 := Array.mkEmpty ◾ _x.4; + let _x.6 := Array.push ◾ _x.5 _x.3; + let _f.7 := _eval._lam_0 _x.6; + let _x.8 := Lean.Elab.Command.liftTermElabM._redArg _f.7 a a a.1; + return _x.8 -/ #guard_msgs in set_option trace.Compiler.saveMono true in diff --git a/tests/elab/meta6.lean.out.expected b/tests/elab/meta6.lean.out.expected index 0d904d6c65..1790a6a7de 100644 --- a/tests/elab/meta6.lean.out.expected +++ b/tests/elab/meta6.lean.out.expected @@ -1,7 +1,7 @@ [Meta.debug] ----- tst2 ----- [Meta.debug] #[a, b, motive, t, inl, inr] [Meta.debug] #[a, b, motive, intro, t] -[Meta.debug] #[x, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0, a._@._internal._hyg.0] +[Meta.debug] #[x, a, a, a, a, a._@._internal._hyg.0] [Meta.debug] @False.elim.{0} (@GT.gt.{0} Nat instLTNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) (@OfNat.ofNat.{0} Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))