Skip to content

Commit da1193c

Browse files
committed
simplify
1 parent c079e05 commit da1193c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Lean/Elab/BindersUtil.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ open TSyntax.Compat in
4848
/--
4949
Expand a match alternative such as `| 0 | 1 => rhs` to an array containing `| 0 => rhs` and `| 1 => rhs`.
5050
-/
51-
def expandMatchAlt (stx : TSyntax ``matchAlt) : MacroM (Array (TSyntax ``matchAlt)) :=
51+
def expandMatchAlt (stx : TSyntax ``matchAlt) : Array (TSyntax ``matchAlt) :=
5252
-- Not using syntax quotations here to keep source location
5353
-- of the pattern sequence (`$term,*`) intact
5454
let patss := stx.raw[1].getSepArgs
5555
if patss.size ≤ 1 then
56-
return #[stx]
56+
#[stx]
5757
else
58-
return patss.map fun pats => stx.raw.setArg 1 (mkNullNode #[pats])
58+
patss.map fun pats => stx.raw.setArg 1 (mkNullNode #[pats])
5959

6060
def shouldExpandMatchAlt : TSyntax ``matchAlt → Bool
6161
| `(matchAltExpr| | $[$patss,*]|* => $_) => patss.size > 1
@@ -65,7 +65,7 @@ def expandMatchAlts? (stx : Syntax) : MacroM (Option Syntax) := do
6565
match stx with
6666
| `(match $[$gen]? $[$motive]? $discrs,* with $alts:matchAlt*) =>
6767
if alts.any shouldExpandMatchAlt then
68-
let alts ← alts.foldlM (init := #[]) fun alts alt => return alts ++ (expandMatchAlt alt)
68+
let alts ← alts.foldlM (init := #[]) fun alts alt => return alts ++ (expandMatchAlt alt)
6969
`(match $[$gen]? $[$motive]? $discrs,* with $alts:matchAlt*)
7070
else
7171
return none

src/Lean/Elab/Do.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ mutual
16211621
let optMotive := doMatch[2]
16221622
let discrs := doMatch[3]
16231623
let matchAlts := doMatch[5][0].getArgs -- Array of `doMatchAlt`
1624-
let matchAlts ← matchAlts.foldlM (init := #[]) fun result matchAlt => return result ++ (← liftMacroM <| expandMatchAlt matchAlt)
1624+
let matchAlts ← matchAlts.foldlM (init := #[]) fun result matchAlt => return result ++ (expandMatchAlt matchAlt)
16251625
let alts ← matchAlts.mapM fun matchAlt => do
16261626
let patterns := matchAlt[1][0]
16271627
let vars ← getPatternsVarsEx patterns.getSepArgs

0 commit comments

Comments
 (0)