Skip to content

Commit bbfb691

Browse files
authored
Syntax: process uncurried types explicitly in the parser/printer. (#5784)
* Syntax: process uncurried types explicitly in the parser/printer. Moved from rescript-lang/syntax#717 * Fix arity 0 . * Fix printing arity0. * Restore ability to convert .ml code with uncurried types. * More restore conversion of .ml uncurried types. * Convert uncurried type tests to .res. * Convert one more test. * Convert empty interface file * Update CHANGELOG.md
1 parent bc2eeeb commit bbfb691

18 files changed

+655
-562
lines changed

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
- `rescript convert <reason files>`
2020
- Remove obsolete built-in project templates and the "rescript init" functionality. This will be replaced by the create-rescript-app project that is maintained separately.
2121
- Parse the attributes of labelled argument to the pattern attributes of argument instead of function.
22+
- Made pinned dependencies transitive: if *a* is a pinned dependency of *b* and *b* is a pinned dependency of *c*, then *a* is implicitly a pinned dependency of *c*. This change is only breaking if your build process assumes non-transitivity.
2223

23-
#### :boom: Breaking Change
24+
#### :nail_care: Polish
2425

25-
- Made pinned dependencies transitive: if *a* is a pinned dependency of *b* and *b* is a pinned dependency of *c*, then *a* is implicitly a pinned dependency of *c*.
26-
- This change is only breaking if your build process assumes non-transitivity. Few if any builds do. In the typical case where you build your monorepo by running `rescript build` on each package in your repo, you don't need to make any changes. There is no way of building with the old, non-transitive behavior.
26+
- Syntax: process uncurried types explicitly in the parser/printer https://github.com/rescript-lang/rescript-compiler/pull/5784
2727

2828
# 10.1.0-rc.3
2929

jscomp/test/build.ninja

+3-3
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ o test/jsoo_485_test.cmi test/jsoo_485_test.cmj : cc test/jsoo_485_test.ml | $bs
419419
o test/key_word_property.cmi test/key_word_property.cmj : cc test/key_word_property.ml | $bsc $stdlib runtime
420420
o test/key_word_property2.cmi test/key_word_property2.cmj : cc test/key_word_property2.ml | test/export_keyword.cmj $bsc $stdlib runtime
421421
o test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj : cc test/key_word_property_plus_test.ml | test/global_mangles.cmj test/mt.cmj $bsc $stdlib runtime
422-
o test/label_uncurry.cmi test/label_uncurry.cmj : cc test/label_uncurry.ml | $bsc $stdlib runtime
422+
o test/label_uncurry.cmi test/label_uncurry.cmj : cc test/label_uncurry.res | $bsc $stdlib runtime
423423
o test/large_integer_pat.cmi test/large_integer_pat.cmj : cc test/large_integer_pat.ml | $bsc $stdlib runtime
424424
o test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj : cc test/large_record_duplication_test.ml | test/mt.cmj $bsc $stdlib runtime
425425
o test/largest_int_flow.cmi test/largest_int_flow.cmj : cc test/largest_int_flow.ml | $bsc $stdlib runtime
@@ -491,8 +491,8 @@ o test/pipe_send_readline.cmi test/pipe_send_readline.cmj : cc test/pipe_send_re
491491
o test/pipe_syntax.cmi test/pipe_syntax.cmj : cc test/pipe_syntax.ml | $bsc $stdlib runtime
492492
o test/poly_empty_array.cmi test/poly_empty_array.cmj : cc test/poly_empty_array.ml | $bsc $stdlib runtime
493493
o test/poly_type.cmi test/poly_type.cmj : cc test/poly_type.ml | $bsc $stdlib runtime
494-
o test/poly_variant_test.cmj : cc_cmi test/poly_variant_test.ml | test/mt.cmj test/poly_variant_test.cmi $bsc $stdlib runtime
495-
o test/poly_variant_test.cmi : cc test/poly_variant_test.mli | $bsc $stdlib runtime
494+
o test/poly_variant_test.cmj : cc_cmi test/poly_variant_test.res | test/mt.cmj test/poly_variant_test.cmi $bsc $stdlib runtime
495+
o test/poly_variant_test.cmi : cc test/poly_variant_test.resi | $bsc $stdlib runtime
496496
o test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj : cc test/polymorphic_raw_test.ml | test/mt.cmj $bsc $stdlib runtime
497497
o test/polymorphism_test.cmj : cc_cmi test/polymorphism_test.ml | test/polymorphism_test.cmi $bsc $stdlib runtime
498498
o test/polymorphism_test.cmi : cc test/polymorphism_test.mli | $bsc $stdlib runtime

jscomp/test/label_uncurry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function u1(f) {
1515
console.log(f(2, "x"));
1616
}
1717

18-
function h(unit) {
18+
function h(x) {
1919
return 3;
2020
}
2121

jscomp/test/label_uncurry.ml

-26
This file was deleted.

jscomp/test/label_uncurry.res

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
type t = (. ~x: int, ~y: string) => int
2+
3+
type u = Js.Fn.arity2<(~x: int, ~y: string) => int>
4+
5+
let f = (x: t): u => x
6+
7+
let u: u = (. ~x, ~y) => x + int_of_string(y)
8+
9+
let u1 = (f: u) => {
10+
f(. ~y="x", ~x=2)->Js.log
11+
f(. ~x=2, ~y="x")->Js.log
12+
}
13+
let h = (. ~x : unit) => 3
14+
15+
let a = u1(u)
16+
17+
type u0 = (. ~x: int=?, ~y: string) => int

jscomp/test/poly_variant_test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ var vv = [
5959
hey_int(4)
6060
];
6161

62-
eq("File \"poly_variant_test.ml\", line 58, characters 5-12", vv, [
62+
eq("File \"poly_variant_test.res\", line 64, characters 5-12", vv, [
6363
3,
6464
0,
6565
4
6666
]);
6767

68-
eq("File \"poly_variant_test.ml\", line 59, characters 5-12", [
68+
eq("File \"poly_variant_test.res\", line 65, characters 5-12", [
6969
hey_int(5),
7070
hey_int(6)
7171
], [
7272
5,
7373
6
7474
]);
7575

76-
eq("File \"poly_variant_test.ml\", line 60, characters 5-12", uu, [
76+
eq("File \"poly_variant_test.res\", line 66, characters 5-12", uu, [
7777
"on_open",
7878
"on_closed",
7979
"in"
@@ -91,9 +91,9 @@ function p_is_int_test(x) {
9191
}
9292
}
9393

94-
eq("File \"poly_variant_test.ml\", line 142, characters 5-12", 2, 2);
94+
eq("File \"poly_variant_test.res\", line 156, characters 5-12", 2, 2);
9595

96-
eq("File \"poly_variant_test.ml\", line 143, characters 5-12", 3, p_is_int_test({
96+
eq("File \"poly_variant_test.res\", line 157, characters 5-12", 3, p_is_int_test({
9797
NAME: "b",
9898
VAL: 2
9999
}));

jscomp/test/poly_variant_test.ml

-164
This file was deleted.

jscomp/test/poly_variant_test.mli

-47
This file was deleted.

0 commit comments

Comments
 (0)