Skip to content

Commit 9d643ea

Browse files
Document definedness condition for substrBytes (#4821)
Co-authored-by: Jost Berthold <jost.berthold@gmail.com>
1 parent 077091b commit 9d643ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • k-distribution/include/kframework/builtin

k-distribution/include/kframework/builtin/domains.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,12 +2109,16 @@ You can get a new `Bytes` object containing a range of bytes from the input
21092109
`Bytes` in O(N) time (where N is the length of the substring). The range
21102110
of bytes included is `[startIndex..endIndex)`. The resulting `Bytes` is
21112111
a copy and mutations to it do not affect mutations to the original `Bytes`.
2112-
The result is `#False` if `startIndex` or `endIndex` are not valid.
21132112

21142113
```k
21152114
syntax Bytes ::= substrBytes(Bytes, startIndex: Int, endIndex: Int) [function, hook(BYTES.substr)]
21162115
```
21172116

2117+
The function is not total: `substrBytes(B, startIndex, endIndex)` is `#Bottom` if
2118+
* `startIndex <Int 0` or
2119+
* `endIndex <Int startIndex` or
2120+
* `lengthBytes(B) <Int endIndex`.
2121+
21182122
### Multiple bytes update
21192123

21202124
You can modify a `Bytes` to return a `Bytes` which is equal to `dest` except the

0 commit comments

Comments
 (0)