Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR fixes spurious unused variable warnings for variables used in non-atomic match discriminants in `do` notation. For example, in `match Json.parse s >>= fromJson? with`, the variable `s` would be reported as unused. The root cause is that `expandNonAtomicDiscrs?` eagerly elaborates the discriminant via `Term.elabTerm`, which creates TermInfo for variable references. The result is then passed to `elabDoElem` for further elaboration. When the match elaboration is postponed (e.g. because the discriminant type contains an mvar from `fromJson?`), the result is a postponed synthetic mvar. The `withTermInfoContext'` wrapper in `elabDoElemFns` checks `isTacticOrPostponedHole?` on this result, detects a postponed mvar, and replaces the info subtree with a `hole` node — discarding all the TermInfo that was accumulated during discriminant elaboration. The fix applies `mkSaveInfoAnnotation` to the result, which prevents `isTacticOrPostponedHole?` from recognizing it as a hole. This is the same mechanism that `elabLetMVar` uses to preserve info trees when the body is a metavariable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| .github | ||
| doc | ||
| images | ||
| releases_drafts | ||
| script | ||
| src | ||
| stage0 | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .gitpod.Dockerfile | ||
| .gitpod.yml | ||
| .ignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| lean-toolchain | ||
| lean.code-workspace | ||
| LICENSE | ||
| LICENSES | ||
| README.md | ||
| RELEASES.md | ||
This is the repository for Lean 4.
About
- Quickstart
- Homepage
- Theorem Proving Tutorial
- Functional Programming in Lean
- Documentation Overview
- Language Reference
- Release notes starting at v4.0.0-m3
- Examples
- External Contribution Guidelines
Installation
See Install Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean.