This PR scans the environment for viable replacements for a dotted identifier (like `.zero`) and suggests concrete alternatives as replacements. ## Example ``` #example .zero ``` Error message: ``` Invalid dotted identifier notation: The expected type of `.cons` could not be determined ``` Additional hint added by this PR: ``` Hint: Using one of these would be unambiguous: [apply] `BitVec.cons` [apply] `List.cons` [apply] `List.Lex.cons` [apply] `List.Pairwise.cons` [apply] `List.Perm.cons` [apply] `List.Sublist.cons` [apply] `List.Lex.below.cons` [apply] `List.Pairwise.below.cons` [apply] `List.Perm.below.cons` [apply] `List.Sublist.below.cons` [apply] `Lean.Grind.AC.Seq.cons` ``` ## Additional changes This PR also brings several related error message descriptions and code actions more in line with each other, changing several "Suggested replacement: " code actions to the more common "Change to " wording, and sorts suggestions obtained from searching the context by the default sort for Names (which prefers names with fewer segments).
37 lines
959 B
Text
37 lines
959 B
Text
/-
|
|
# Testing monad lift coercion elaborator
|
|
|
|
The functions inserted for the coercions are supposed to be inlined immediately during elaboration.
|
|
-/
|
|
|
|
set_option pp.mvars false
|
|
|
|
variable (p : Nat → Prop) (m : IO (Subtype p))
|
|
|
|
/-!
|
|
`Lean.Internal.liftCoeM`
|
|
-/
|
|
#check (m : (ReaderT Int IO) Nat)
|
|
|
|
/-!
|
|
`Lean.Internal.coeM`
|
|
-/
|
|
#check (m : IO Nat)
|
|
|
|
/-!
|
|
Making sure the monad lift coercion elaborator does not have side effects.
|
|
|
|
It used to be responsible for hinting that the LHSs of equalities were defeq, like in the following example.
|
|
It was checking that `Eq (some true)` and `Eq _` were defeq monads. The defeq check caused `_` to be solved as `some true`.
|
|
-/
|
|
/--
|
|
error: Invalid dotted identifier notation: The expected type of `.some` could not be determined
|
|
|
|
Hint: Using one of these would be unambiguous:
|
|
[apply] `some`
|
|
[apply] `Option.Rel.some`
|
|
-/
|
|
#guard_msgs in
|
|
example : some true = (some true).map id := by
|
|
refine show _ = .some true from ?_
|
|
rfl
|