Skip to content

Commit b5e42a9

Browse files
committed
Tweak messages, be more opinionated about string replacement, and fix tests
1 parent 24c5ed5 commit b5e42a9

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/Init/Data/String/Search.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def contains (s : String) (pat : ρ) [ToForwardSearcher pat σ] : Bool :=
332332
def Internal.containsImpl (s : String) (c : Char) : Bool :=
333333
String.contains s c
334334

335-
@[inline, inherit_doc contains, suggest_for String.some]
335+
@[inline, inherit_doc contains]
336336
def any (s : String) (pat : ρ) [ToForwardSearcher pat σ] : Bool :=
337337
s.contains pat
338338

src/Lean/Elab/App.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ where
14341434
(suggestions.map fun suggestion => {
14351435
preInfo? := .some ".",
14361436
suggestion := suggestion.getString!,
1437-
toCodeActionTitle? := .some (s!"Change to {e}.{·}"),
1437+
toCodeActionTitle? := .some (s!"Change to .{·}"),
14381438
diffGranularity := .all,
14391439
})
14401440
else

tests/lean/run/idSuggestEvery.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ of type
1919
error: Unknown constant `Subarray.every`
2020
2121
Hint: Perhaps you meant `Subarray.all` in place of `Subarray.every`:
22-
S̵u̵b̵a̵r̵r̵a̵y̵.̵e̵v̵e̵r̵y̵S̲u̲b̲a̲r̲r̲a̲y̲.̲a̲l̲l̲
22+
[apply] `Subarray.all`
2323
-/
2424
#guard_msgs in example := (@Subarray.every Nat (fun _ => true) ·)
2525
#guard_msgs in example := (@Subarray.all Nat (fun _ => true) ·)
@@ -28,7 +28,7 @@ Hint: Perhaps you meant `Subarray.all` in place of `Subarray.every`:
2828
error: Unknown constant `Subarray.some`
2929
3030
Hint: Perhaps you meant `Subarray.any` in place of `Subarray.some`:
31-
S̵u̵b̵a̵r̵r̵a̵y̵.̵s̵o̵m̵e̵S̲u̲b̲a̲r̲r̲a̲y̲.̲a̲n̲y̲
31+
[apply] `Subarray.any`
3232
-/
3333
#guard_msgs in example := (@Subarray.some Nat (fun _ => true) ·)
3434
#guard_msgs in example := (@Subarray.any Nat (fun _ => true) ·)
@@ -48,12 +48,11 @@ error: Invalid field `some`: The environment does not contain `String.some`, so
4848
x
4949
of type `String`
5050
51-
Hint: Perhaps you meant one of these in place of `String.some`:
52-
[apply] `String.contains`
53-
[apply] `String.any`
51+
Hint: Perhaps you meant `String.contains` in place of `String.some`:
52+
.s̵o̵m̵e̵c̲o̲n̲t̲a̲i̲n̲s̲
5453
-/
5554
#guard_msgs in example (x : String) := x.some fun _ => true
56-
#guard_msgs in example (x : String) := x.all fun _ => true
55+
#guard_msgs in example (x : String) := x.contains fun _ => true
5756

5857

5958
/--

tests/lean/run/idSuggestStandalone.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Hint: Perhaps you meant `String.foo` in place of `String.test0`:
4343
error: Unknown constant `String.test0`
4444
4545
Hint: Perhaps you meant `String.foo` in place of `String.test0`:
46-
S̵t̵r̵i̵n̵g̵.̵t̵e̵s̵t̵0̵S̲t̲r̲i̲n̲g̲.̲f̲o̲o̲
46+
[apply] `String.foo`
4747
---
4848
info: fun x1 x2 x3 => sorry : (x1 : ?m.1) → (x2 : ?m.5 x1) → (x3 : ?m.6 x1 x2) → ?m.7 x1 x2 x3
4949
-/

0 commit comments

Comments
 (0)