Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: deprecate Array.modifyOp #5797

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Init/Data/Array/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ def modifyM [Monad m] (a : Array α) (i : Nat) (f : α → m α) : m (Array α)
def modify (a : Array α) (i : Nat) (f : α → α) : Array α :=
Id.run <| modifyM a i f

@[inline]
def modifyOp (self : Array α) (idx : Nat) (f : α → α) : Array α :=
self.modify idx f
@[deprecated modify (since := "2024-10-22")] abbrev modifyOp := @modify

/--
We claim this unsafe implementation is correct because an array cannot have more than `usizeSz` elements in our runtime.
Expand Down
2 changes: 1 addition & 1 deletion src/Lean/Elab/StructInst.lean
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private def elabModifyOp (stx modifyOp : Syntax) (sources : Array ExplicitSource
let lval := modifyOp[0][0]
let idx := lval[1]
let self := sources[0]!.stx
let stxNew ← `($(self).modifyOp (idx := $idx) (fun s => $val))
let stxNew ← `($(self).modify (i := $idx) (fun s => $val))
trace[Elab.struct.modifyOp] "{stx}\n===>\n{stxNew}"
withMacroExpansion stx stxNew <| elabTerm stxNew expectedType?
let rest := modifyOp[0][1]
Expand Down
13 changes: 12 additions & 1 deletion stage0/src/kernel/declaration.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stage0/src/kernel/declaration.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions stage0/src/kernel/expr.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 30 additions & 4 deletions stage0/src/kernel/expr.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions stage0/src/kernel/inductive.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion stage0/stdlib/Init.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion stage0/stdlib/Init/Data/Array.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading