This PR replaces `Array.feraseIdx` and `Array.insertAt` with `Array.eraseIdx` and `Array.insertIdx`, both of which take a `Nat` argument and a tactic-provided proof that it is in bounds. We also have `eraseIdxIfInBounds` and `insertIdxIfInBounds` which are noops if the index is out of bounds. We also provide a `Fin` valued version of `Array.findIdx?`. Together, these quite ergonomically improve the array indexing safety at a number of places in the compiler/elaborator.
41 lines
1.3 KiB
Text
41 lines
1.3 KiB
Text
{"textDocument": {"uri": "file:///completionDocString.lean"},
|
|
"position": {"line": 0, "character": 21}}
|
|
{"items":
|
|
[{"sortText": "0",
|
|
"label": "insertIdx",
|
|
"kind": 3,
|
|
"documentation":
|
|
{"value": "Insert element `a` at position `i`. ", "kind": "markdown"},
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionDocString.lean"},
|
|
"position": {"line": 0, "character": 21}},
|
|
"id": {"const": {"declName": "Array.insertIdx"}},
|
|
"cPos": 0}},
|
|
{"sortText": "1",
|
|
"label": "insertIdxIfInBounds",
|
|
"kind": 3,
|
|
"documentation":
|
|
{"value":
|
|
"Insert element `a` at position `i`, or do nothing if `as.size < i`. ",
|
|
"kind": "markdown"},
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionDocString.lean"},
|
|
"position": {"line": 0, "character": 21}},
|
|
"id": {"const": {"declName": "Array.insertIdxIfInBounds"}},
|
|
"cPos": 0}},
|
|
{"sortText": "2",
|
|
"label": "insertIdx!",
|
|
"kind": 3,
|
|
"documentation":
|
|
{"value":
|
|
"Insert element `a` at position `i`. Panics if `i` is not `i ≤ as.size`. ",
|
|
"kind": "markdown"},
|
|
"data":
|
|
{"params":
|
|
{"textDocument": {"uri": "file:///completionDocString.lean"},
|
|
"position": {"line": 0, "character": 21}},
|
|
"id": {"const": {"declName": "Array.insertIdx!"}},
|
|
"cPos": 0}}],
|
|
"isIncomplete": true}
|