fix: use correct number of none patterns for antiquotation splice

This commit is contained in:
Mario Carneiro 2022-04-27 00:55:27 -07:00 committed by GitHub
parent 02d0a89229
commit f37b700e6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -131,7 +131,7 @@ private partial def quoteSyntax : Syntax → TermElabM Syntax
let arr ← match k with
| `optional => `(match $[$ids:ident],* with
| $[some $ids:ident],* => $(quote inner)
| none => Array.empty)
| $[_%$ids],* => Array.empty)
| _ =>
let arr ← ids[:ids.size-1].foldrM (fun id arr => `(Array.zip $id $arr)) ids.back
`(Array.map (fun $(← mkTuple ids) => $(inner[0])) $arr)

5
tests/lean/run/1124.lean Normal file
View file

@ -0,0 +1,5 @@
open Lean
syntax "foo" (ident ident)? : term
variable (x y : Option Syntax)
example : MacroM Syntax := `(foo $[$x:ident $y:ident]?)