Skip to content

Commit 5f2f1b7

Browse files
fhammerschmidtmvaledclaude
authored
Forward-port integer range regression tests to v13 (#8718)
* Forward-port integer range regression tests to v13 Port the ReScript regression test from #8714 unchanged and regenerate the JavaScript snapshot with the v13 compiler. The compiler already handles these patterns correctly after removing Pisout. Original-commit: 54ab807 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Manuel Vázquez Acosta <mva.led@gmail.com> Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com> * Document v13 integer range regression coverage Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com> --------- Signed-off-by: Manuel Vázquez Acosta <mva.led@gmail.com> Signed-off-by: Florian Hammerschmidt <florianh89@gmail.com> Co-authored-by: Manuel Vázquez Acosta <mva.led@gmail.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent ca06dc0 commit 5f2f1b7

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
#### :house: Internal
5252

53+
- Forward-port integer range pattern regression coverage from v12 to v13. https://github.com/rescript-lang/rescript/pull/8718
5354
- Remove the unused `res.iflet` encoding of `if let`, which the parser always rejects with a syntax error suggesting a `switch`. The error is unchanged. https://github.com/rescript-lang/rescript/pull/8741
5455
- Represent variant spread patterns (`...t`) with a dedicated `Ppat_variant_spread` parsetree node instead of `Ppat_type` with a `res.patVariantSpread` attribute, which remains only in the PPX wire representation. https://github.com/rescript-lang/rescript/pull/8742
5556
- Remove the obsolete `res.ternary` and `JSX` attributes from the formatter's internal attribute filters and merge the filters into one. https://github.com/rescript-lang/rescript/pull/8740
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Mocha from "mocha";
4+
import * as Test_utils from "./test_utils.mjs";
5+
6+
function isRetriable(error) {
7+
let match = error.status;
8+
return !(match > 504 || match < 502);
9+
}
10+
11+
Mocha.describe("Or_pattern_int_range_test", () => {
12+
Mocha.test("int range on record field", () => Test_utils.eq("File \"or_pattern_int_range_test.res\", line 15, characters 6-13", [
13+
404,
14+
500,
15+
501,
16+
502,
17+
503,
18+
504,
19+
505
20+
].map(status => isRetriable({
21+
status: status
22+
})), [
23+
false,
24+
false,
25+
false,
26+
true,
27+
true,
28+
true,
29+
false
30+
]));
31+
});
32+
33+
export {
34+
isRetriable,
35+
}
36+
/* Not a pure module */
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
open Mocha
2+
open Test_utils
3+
4+
type response = {status: int}
5+
6+
let isRetriable = error =>
7+
switch error {
8+
| {status: 502 | 503 | 504} => true
9+
| _ => false
10+
}
11+
12+
describe(__MODULE__, () => {
13+
test("int range on record field", () => {
14+
eq(
15+
__LOC__,
16+
[404, 500, 501, 502, 503, 504, 505]->Array.map(status => isRetriable({status: status})),
17+
[false, false, false, true, true, true, false],
18+
)
19+
})
20+
})

0 commit comments

Comments
 (0)