Skip to content

Commit a20fa10

Browse files
authored
Remove deprecations from Belt functions ending in Exn (#7590)
* Remove deprecations from Belt functions ending in Exn * Update CHANGELOG
1 parent 9b911ac commit a20fa10

20 files changed

+17
-38
lines changed

CHANGELOG.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@
1515
#### :boom: Breaking Change
1616

1717
- The legacy rescript cli can be called through rewatch via `rewatch legacy`. Arguments to rewatch need to be passed after the subcommand. Argument `--compiler-args` is now a subcommand `compiler-args`. https://github.com/rescript-lang/rescript/pull/7551
18-
- Rename `Belt` functions ending with `Exn` to end with `OrThrow` https://github.com/rescript-lang/rescript/pull/7581 The following `Exn` functions are now deprecated:
19-
- `Belt.Array.getExn``Belt.Array.getOrThrow`
20-
- `Belt.Array.setExn``Belt.Array.setOrThrow`
21-
- `Belt.Map.getExn``Belt.Map.getOrThrow`
22-
- `Belt.MutableMap.getExn``Belt.MutableMap.getOrThrow`
23-
- `Belt.Set.getExn``Belt.Set.getOrThrow`
24-
- `Belt.MutableSet.getExn``Belt.MutableSet.getOrThrow`
25-
- `Belt.List.getExn``Belt.List.getOrThrow`
26-
- `Belt.List.tailExn``Belt.List.tailOrThrow`
27-
- `Belt.List.headExn``Belt.List.headOrThrow`
28-
- `Belt.MutableQueue.peekExn``Belt.MutableQueue.peekOrThrow`
29-
- `Belt.MutableQueue.popExn``Belt.MutableQueue.popOrThrow`
30-
- `Belt.Option.getExn``Belt.Option.getOrThrow`
31-
- `Belt.Result.getExn``Belt.Result.getOrThrow`
32-
- Old functions remain available but are marked as deprecated with guidance to use the new `OrThrow` variants.
18+
19+
#### :rocket: New Feature
20+
21+
- Add `OrThrow` aliases for `Belt` functions ending with `Exn`. https://github.com/rescript-lang/rescript/pull/7581, https://github.com/rescript-lang/rescript/pull/7590 The following aliases have been added:
22+
- `Belt.Array.getOrThrow`
23+
- `Belt.Array.setOrThrow`
24+
- `Belt.Map.getOrThrow`
25+
- `Belt.MutableMap.getOrThrow`
26+
- `Belt.Set.getOrThrow`
27+
- `Belt.MutableSet.getOrThrow`
28+
- `Belt.List.getOrThrow`
29+
- `Belt.List.tailOrThrow`
30+
- `Belt.List.headOrThrow`
31+
- `Belt.MutableQueue.peekOrThrow`
32+
- `Belt.MutableQueue.popOrThrow`
33+
- `Belt.Option.getOrThrow`
34+
- `Belt.Result.getOrThrow`
3335

3436
#### :bug: Bug fix
3537

runtime/Belt_Array.resi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ let get: (t<'a>, int) => option<'a>
5050
Raise an exception if `i` is out of range.
5151
Otherwise return the value at index `i` in `arr`.
5252
*/
53-
@deprecated("Use 'getOrThrow' instead")
5453
let getExn: (t<'a>, int) => 'a
5554

5655
/**
@@ -86,7 +85,6 @@ let set: (t<'a>, int, 'a) => bool
8685
/**
8786
`setExn(arr, i, x)` raise an exception if `i` is out of range.
8887
*/
89-
@deprecated("Use 'setOrThrow' instead")
9088
let setExn: (t<'a>, int, 'a) => unit
9189

9290
/**

runtime/Belt_List.resi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ switch Belt.List.headExn(list{}) { // Raises an Error
7777
}
7878
```
7979
*/
80-
@deprecated("Use `headOrThrow` instead")
8180
let headExn: t<'a> => 'a
8281

8382
/**
@@ -126,7 +125,6 @@ switch Belt.List.tailExn(list{}) { // Raises an Error
126125
}
127126
```
128127
*/
129-
@deprecated("Use `tailOrThrow` instead")
130128
let tailExn: t<'a> => t<'a>
131129

132130
/**
@@ -192,7 +190,6 @@ switch abc->Belt.List.getExn(4) { // Raises an Error
192190
}
193191
```
194192
*/
195-
@deprecated("Use `getOrThrow` instead")
196193
let getExn: (t<'a>, int) => 'a
197194

198195
/**

runtime/Belt_Map.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ See `Belt.Map.get`
383383
384384
raise when `k` not exist
385385
*/
386-
@deprecated("Use `getOrThrow` instead")
387386
let getExn: (t<'k, 'v, 'id>, 'k) => 'v
388387

389388
/**

runtime/Belt_MapDict.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ let getUndefined: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => Js.undefined<'a>
153153

154154
let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a, ~cmp: cmp<'k, 'id>) => 'a
155155

156-
@deprecated("Use `getOrThrow` instead")
157156
let getExn: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => 'a
158157

159158
let getOrThrow: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => 'a

runtime/Belt_MapInt.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ let getUndefined: (t<'v>, key) => Js.undefined<'v>
114114

115115
let getWithDefault: (t<'v>, key, 'v) => 'v
116116

117-
@deprecated("Use `getOrThrow` instead")
118117
let getExn: (t<'v>, key) => 'v
119118

120119
let getOrThrow: (t<'v>, key) => 'v

runtime/Belt_MapString.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ let getUndefined: (t<'v>, key) => Js.undefined<'v>
114114

115115
let getWithDefault: (t<'v>, key, 'v) => 'v
116116

117-
@deprecated("Use `getOrThrow` instead")
118117
let getExn: (t<'v>, key) => 'v
119118

120119
let getOrThrow: (t<'v>, key) => 'v

runtime/Belt_MutableMap.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ let maxUndefined: t<'k, 'a, _> => Js.undefined<('k, 'a)>
120120
let get: (t<'k, 'a, 'id>, 'k) => option<'a>
121121
let getUndefined: (t<'k, 'a, 'id>, 'k) => Js.undefined<'a>
122122
let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a) => 'a
123-
@deprecated("Use `getOrThrow` instead")
124123
let getExn: (t<'k, 'a, 'id>, 'k) => 'a
125124
let getOrThrow: (t<'k, 'a, 'id>, 'k) => 'a
126125
/** Raise when invariant is not held. */

runtime/Belt_MutableMapInt.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
105105
let get: (t<'a>, key) => option<'a>
106106
let getUndefined: (t<'a>, key) => Js.undefined<'a>
107107
let getWithDefault: (t<'a>, key, 'a) => 'a
108-
@deprecated("Use `getOrThrow` instead")
109108
let getExn: (t<'a>, key) => 'a
110109
let getOrThrow: (t<'a>, key) => 'a
111110

runtime/Belt_MutableMapString.resi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
105105
let get: (t<'a>, key) => option<'a>
106106
let getUndefined: (t<'a>, key) => Js.undefined<'a>
107107
let getWithDefault: (t<'a>, key, 'a) => 'a
108-
@deprecated("Use `getOrThrow` instead")
109108
let getExn: (t<'a>, key) => 'a
110109
let getOrThrow: (t<'a>, key) => 'a
111110

0 commit comments

Comments
 (0)