Basic support for auto bound implicit local names #
Remark: Issue #255 exposed a nasty interaction between macro scopes and auto-bound-implicit names.
local notation "A" => id x
theorem test : A = A := sorry
We used to use n.eraseMacroScopes at isValidAutoBoundImplicitName and isValidAutoBoundLevelName.
Thus, in the example above, when A is expanded, a x with a fresh macro scope is created.
x+macros-scope is not in scope and is a valid auto-bound implicit name after macro scopes are erased.
So, an auto-bound exception would be thrown, and x+macro-scope would be added as a new implicit.
When, we try again, a x with a new macro scope is created and this process keeps repeating.
Therefore, we don't consider identifier with macro scopes anymore.
An .error value should be treated as a false—this is not a valid auto-bound implicit name—
but it contains additional notes (above and beyond Unknown identifier) to attach to
an error message.
Instances For
Tracks extra context needed within the scope of Lean.Elab.Term.withAutoBoundImplicit
- autoImplicitEnabled : Bool
This always matches the
autoImplicitoption; it is duplicated here in order to support the behavior of the deprecatedLean.Elab.Term.Context.autoImplicitmethod. Tracks a working set of variables that the auto-binding process currently anticipates adding implicit binding for.
Instances For
Pushes a new variable onto the autoImplicit context, indicating that it needs to be bound as an implicit parameter.