This PR modifies `#eval e` to elaborate `e` with section variables in scope. While evaluating expressions with free variables is not possible, this lets `#eval` give a better error message than "unknown identifier." Example: ```lean section variable (n : Nat) /-- error: Cannot evaluate, contains free variable `n` -/ #guard_msgs in #eval n end ``` The error is localized to `#eval`. It would be more friendly if the error were to be placed on uses of free variables. [Zulip discussion](https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Unknown.20identifier.20error.20messages.20for.20.60.23eval.60/near/560864544)
11 lines
422 B
Text
11 lines
422 B
Text
440.lean:1:21-1:22: error: don't know how to synthesize placeholder
|
|
context:
|
|
⊢ True
|
|
440.lean:4:29-4:30: error: don't know how to synthesize placeholder
|
|
context:
|
|
x : Nat
|
|
⊢ Nat
|
|
f (x : Nat) : Nat
|
|
440.lean:11:0-11:5: error: Aborting evaluation since the expression depends on the 'sorry' axiom, which can lead to runtime instability and crashes.
|
|
|
|
To attempt to evaluate anyway despite the risks, use the '#eval!' command.
|