leanprover / leanprover/lean4

Elaborator doesn't produce `InfoTree` for incomplete `match` and incomplete terms in `apply`

Open
#5,336 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Description

In incomplete match statements and in incomplete terms in apply, the elaborator often does not produce InfoTrees.

Context

This issue is derived from #5172. #5299 resolves the fact that completion doesn't trigger in these contexts, but it doesn't resolve the underlying problem that the elaborator does not produce InfoTrees in this example, which are also needed for all kinds of other language server features.

Steps to Reproduce

Consider the following example from #5172:

set_option trace.Elab.info true

inductive Direction where
  | up
  | right
  | down
  | left
deriving Repr

def angle (d: Direction) :=
  match d with
  | Direction. => 90 
  | Direction.right => 0
  | Direction.down => 270
  | Direction.left => 180

example : p ∨ (q ∧ r) → (p ∨ q) ∧ (p ∨ r) := by
  intro h
  cases h with
  | inl hp => apply And. (Or.intro_left q hp) (Or.intro_left r hp)
  | inr hqr => apply And.intro (Or.intro_right p hqr.left) (Or.intro_right p hqr.right)

In angle, all InfoTree information for the incomplete match statement is missing. In the example, all InfoTree information for the incomplete term in the first apply is missing.

Versions

Current master (ec98c92).

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in the issue and enable trace.Elab.info to compare the incomplete match and apply cases. Trace how elaboration handles these incomplete terms and where InfoTrees are normally produced. Done means both examples produce the expected InfoTree information while preserving existing elaboration behavior.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.