-
Notifications
You must be signed in to change notification settings - Fork 717
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - 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
When doing a match with alternatives of both literal values and constructors of those literal value types, an unknown free variable error appears.
Context
Steps to Reproduce
A few examples that reproduce the error on Lean nightly on the Lean playground:
def stringMatch : Option Nat :=
match "Bad" with
| String.ofByteArray _ _ => some 1
| "Eek" => some 2
| _ => none -- unknown free variable `_fvar.149`
def charMatch :=
match 'X' with
| Char.mk 5 _ => some 1
| 'A' => some 2
| _ => none -- unknown free variable `_fvar.836`
def uInt8Match :=
match (5: UInt8) with
| UInt8.ofBitVec (BitVec.ofFin 3) => some 1
| 5 => some 2
| _ => none -- unknown free variable `_fvar.1026`
Expected behavior: The match statement either works with both kinds of pattern, or gives a clear error describing what the problem is and what the developer should do.
Actual behavior: The match statement gives an unclear and unactionable error.
Versions
Lean 4.26.0-nightly-2025-11-14
Target: x86_64-unknown-linux-gnu
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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working