chore: post-bootstrap cleanup

This commit is contained in:
Gabriel Ebner 2022-10-11 13:00:23 -07:00
parent 2649b4facd
commit c8bb2ea3cf
2 changed files with 4 additions and 9 deletions

View file

@ -55,11 +55,10 @@ def expandMatchAlts? (stx : Syntax) : MacroM (Option Syntax) := do
open TSyntax.Compat in
def clearInMatchAlt (stx : TSyntax ``matchAlt) (vars : Array Ident) : TSyntax ``matchAlt :=
stx.1.modifyArg 3 fun rhs => Id.run do
stx.1.modifyArg 3 fun rhs => Unhygienic.run do
let mut rhs := rhs
for v in vars do
-- rhs ← `(clear% $v; $rhs)
rhs := mkNode `Lean.Parser.Term.clear #[mkAtom "clear%", v, mkNullNode, rhs]
rhs ← `(clear% $v; $rhs)
return rhs
def clearInMatch (stx : Syntax) (vars : Array Ident) : MacroM Syntax := do

View file

@ -583,12 +583,8 @@ abbrev IdxSet := HashSet Nat
private partial def hasNoErrorIfUnused : Syntax → Bool
| `(no_error_if_unused% $_) => true
-- | `(clear% $_; $body) => hasNoErrorIfUnused body
| stx =>
if stx.getKind == `Lean.Parser.Term.clear then
hasNoErrorIfUnused stx[3]
else
false
| `(clear% $_; $body) => hasNoErrorIfUnused body
| _ => false
/--
Given `rhss` the right-hand-sides of a `match`-syntax notation,