Open
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- [ X] Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - [X ] Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - [X ] Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
MWE:
import Lean.Meta.Basic
open Lean Meta
def test1 : Nat :=
let a : (Sum Nat Nat) := .inr 1
let b : (Sum Nat Nat) := .inl 1
let c : (Sum Nat Nat) := .inr 1
match a, b, c with
| .inr x , .inl y, inr z => return x+y+z
| _,_,_ => return 37
def test2 : MetaM Nat:= do
let a : MetaM (Sum Nat Nat) := return .inr 1
let b : MetaM (Sum Nat Nat) := return .inl 1
let c : MetaM (Sum Nat Nat) := return .inr 1
match ← a, ← b, ← c with
| .inr x , .inl y, inr z => return x+y+z
| _,_,_ => return 37
def test3 : MetaM Nat:= do
let a : MetaM (Sum Nat Nat) := return .inr 1
let b : MetaM (Sum Nat Nat) := return .inl 1
let c : MetaM (Sum Nat Nat) := return .inr 1
let a ← a
let b ← b
let c ← c
match a, b, c with
| .inr x , .inl y, inr z => return x+y+z
| _,_,_ => return 37
In test1
, the correct error message invalid pattern, constructor ...
is thrown, but in the two others, we get the incorrect unsupported pattern in syntax match .inr x
Context
No discussion on Zulip.
Steps to Reproduce
- Copy mwe into live.lean
Expected behavior: Get test2
and test3
to display the same error as test1
Actual behavior: Incorrect error message
Versions
"4.21.0-nightly-2025-05-12"
live.lean-lang.org
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.