Skip to content

Commit e81ac6a

Browse files
author
mathlib4-bot
committed
chore: adaptations for nightly-2025-07-22
2 parents 23962d9 + dddfa03 commit e81ac6a

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

Batteries/CodeAction/Attr.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def TacticCodeActions.insert (self : TacticCodeActions)
6363
{ self with onAnyTactic := self.onAnyTactic.push action }
6464
else
6565
{ self with onTactic := tacticKinds.foldl (init := self.onTactic) fun m a =>
66-
m.insert a ((m.findD a #[]).push action) }
66+
m.insert a ((m.getD a #[]).push action) }
6767

6868
/-- An extension which collects all the tactic code actions. -/
6969
initialize tacticSeqCodeActionExt :

Batteries/Data/NameSet.lean

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,12 @@ instance : Singleton Name NameSet where
1212
singleton := fun n => (∅ : NameSet).insert n
1313

1414
instance : Union NameSet where
15-
union := fun s t => s.fold (fun t n => t.insert n) t
15+
union := fun s t => s.foldl (fun t n => t.insert n) t
1616

1717
instance : Inter NameSet where
18-
inter := fun s t => s.fold (fun r n => if t.contains n then r.insert n else r) {}
18+
inter := fun s t => s.foldl (fun r n => if t.contains n then r.insert n else r) {}
1919

2020
instance : SDiff NameSet where
21-
sdiff := fun s t => t.fold (fun s n => s.erase n) s
22-
23-
/-- Create a `Lean.NameSet` from a `List`. This operation is `O(n)` in the length of the list. -/
24-
def ofList (l : List Name) : NameSet :=
25-
l.foldl (fun s n => s.insert n) {}
26-
27-
/-- Create a `Lean.NameSet` from an `Array`. This operation is `O(n)` in the size of the array. -/
28-
def ofArray (a : Array Name) : NameSet :=
29-
a.foldl (fun s n => s.insert n) {}
21+
sdiff := fun s t => t.foldl (fun s n => s.erase n) s
3022

3123
end Lean.NameSet

Batteries/Data/String/Lemmas.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import Batteries.Tactic.Lint.Misc
1010
import Batteries.Tactic.SeqFocus
1111
import Std.Classes.Ord.String -- Not needed here, but imported to ensure instance names don't clash.
1212

13+
14+
-- Commented out temporarily as this is broken on nightly-2025-07-22
15+
/-
16+
1317
namespace String
1418
1519
-- TODO(kmill): add `@[ext]` attribute to `String.ext` in core.
@@ -1089,3 +1093,5 @@ theorem dropWhile_eq (p : Char → Bool) (s : String) : s.dropWhile p = ⟨s.1.d
10891093
(s.dropWhile p).1 = s.1.dropWhile p := by rw [dropWhile_eq]
10901094
10911095
end String
1096+
1097+
-/

Batteries/Tactic/HelpCmd.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ syntax withPosition("#help " colGt &"option" (colGt ppSpace Parser.rawIdent)?) :
4949

5050
private def elabHelpOption (id : Option Ident) : CommandElabM Unit := do
5151
let id := id.map (·.raw.getId.toString false)
52-
let mut decls : Lean.RBMap _ _ compare := {}
53-
for (name, decl) in show Lean.RBMap .. from ← getOptionDecls do
52+
let mut decls : Std.TreeMap _ _ compare := {}
53+
for (name, decl) in show NameMap OptionDecl from ← getOptionDecls do
5454
let name := name.toString false
5555
if let some id := id then
5656
if !id.isPrefixOf name then
@@ -96,7 +96,7 @@ syntax withPosition("#help " colGt (&"attr" <|> &"attribute")
9696

9797
private def elabHelpAttr (id : Option Ident) : CommandElabM Unit := do
9898
let id := id.map (·.raw.getId.toString false)
99-
let mut decls : Lean.RBMap _ _ compare := {}
99+
let mut decls : Std.TreeMap _ _ compare := {}
100100
/-
101101
#adaptation_note
102102
On nightly-2024-06-21, added the `.toList` here:
@@ -179,7 +179,7 @@ syntax withPosition("#help " colGt &"cats" (colGt ppSpace Parser.rawIdent)?) : c
179179

180180
private def elabHelpCats (id : Option Ident) : CommandElabM Unit := do
181181
let id := id.map (·.raw.getId.toString false)
182-
let mut decls : Lean.RBMap _ _ compare := {}
182+
let mut decls : Std.TreeMap _ _ compare := {}
183183
for (name, cat) in (Parser.parserExtension.getState (← getEnv)).categories do
184184
let name := name.toString false
185185
if let some id := id then
@@ -221,8 +221,8 @@ syntax withPosition("#help " colGt &"cat" "+"? colGt ident
221221

222222
private def elabHelpCat (more : Option Syntax) (catStx : Ident) (id : Option String) :
223223
CommandElabM Unit := do
224-
let mut decls : Lean.RBMap _ _ compare := {}
225-
let mut rest : Lean.RBMap _ _ compare := {}
224+
let mut decls : Std.TreeMap _ _ compare := {}
225+
let mut rest : Std.TreeMap _ _ compare := {}
226226
let catName := catStx.getId.eraseMacroScopes
227227
let some cat := (Parser.parserExtension.getState (← getEnv)).categories.find? catName
228228
| throwErrorAt catStx "{catStx} is not a syntax category"
@@ -236,7 +236,7 @@ private def elabHelpCat (more : Option Syntax) (catStx : Ident) (id : Option Str
236236
if !id.isPrefixOf tk then
237237
continue
238238
used := true
239-
decls := decls.insert tk ((decls.findD tk #[]).push k)
239+
decls := decls.insert tk ((decls.getD tk #[]).push k)
240240
if !used && id.isNone then
241241
rest := rest.insert (k.toString false) k
242242
let mut msg := MessageData.nil

Batteries/Tactic/Lint/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ initialize batteriesLinterExt :
8484
addImportedFn := fun nss => pure <|
8585
nss.foldl (init := {}) fun m ns => ns.foldl (init := m) addEntryFn
8686
addEntryFn
87-
exportEntriesFn := fun es => es.fold (fun a _ e => a.push e) #[]
87+
exportEntriesFn := fun es => es.foldl (fun a _ e => a.push e) #[]
8888
}
8989

9090
/--

Batteries/Tactic/PrintDependents.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ elab tk:"#print" &"dependents" ids:(ppSpace colGt ident)* : command => do
110110
| some (ConstantInfo.recInfo v) => v.type.getUsedConstants
111111
| some (ConstantInfo.inductInfo v) => v.type.getUsedConstants ++ v.ctors
112112
| _ => #[]
113-
for c in RBTree.fromArray consts Name.cmp do
113+
for c in Std.TreeSet.ofArray consts Name.cmp do
114114
if state.result.find? c = some true then
115115
msg := msg ++ m!"{MessageData.ofConst (← mkConstWithLevelParams c)} "
116116
return msg

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:nightly-2025-07-21
1+
leanprover/lean4:nightly-2025-07-22

0 commit comments

Comments
 (0)