Skip to content

Commit 6c85f75

Browse files
committed
10.1_release -> master
2 parents 1a7152b + 344a3b7 commit 6c85f75

File tree

108 files changed

+13256
-11277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+13256
-11277
lines changed

.github/workflows/ci.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ jobs:
6969
run: opam exec -- node scripts/ciTest.js -mocha -theme -format
7070

7171
- name: Get artifact info
72-
id: get_artifact_info
7372
run: node .github/workflows/get_artifact_info.js
7473

7574
- name: "Upload artifacts: binaries"
7675
uses: actions/upload-artifact@v3
7776
with:
78-
name: ${{ steps.get_artifact_info.outputs.artifact_name }}
79-
path: ${{ steps.get_artifact_info.outputs.artifact_path }}
77+
name: ${{ env.artifact_name }}
78+
path: ${{ env.artifact_path }}
8079

8180
- name: "Upload artifacts: lib/ocaml"
8281
if: runner.os == 'Linux'
@@ -140,7 +139,6 @@ jobs:
140139
working-directory: packages/std
141140

142141
- name: Get package info
143-
id: get_package_info
144142
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
145143
run: node .github/workflows/get_package_info.js ${{ github.event.pull_request.head.sha }}
146144

@@ -149,8 +147,8 @@ jobs:
149147
with:
150148
name: npm-packages
151149
path: |
152-
${{ steps.get_package_info.outputs.rescript_package }}
153-
${{ steps.get_package_info.outputs.stdlib_package }}
150+
${{ env.rescript_package }}
151+
${{ env.stdlib_package }}
154152
155153
installationTest:
156154
needs: package
+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const fs = require("fs");
2+
const os = require("os");
3+
14
const artifactPath =
25
process.platform === "darwin" && process.arch === "arm64"
36
? process.platform + process.arch
@@ -6,5 +9,7 @@ const artifactPath =
69
const artifactName = "binaries-" + artifactPath;
710

811
// Pass artifactPath and artifactName to subsequent GitHub actions
9-
console.log(`::set-output name=artifact_path::${artifactPath}`);
10-
console.log(`::set-output name=artifact_name::${artifactName}`);
12+
fs.appendFileSync(
13+
process.env.GITHUB_ENV,
14+
`artifact_path=${artifactPath}${os.EOL}artifact_name=${artifactName}${os.EOL}`
15+
);

.github/workflows/get_package_info.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const fs = require("fs");
2+
const os = require("os");
23

34
const packageSpec = JSON.parse(fs.readFileSync("./package.json", "utf8"));
45
const { name, version } = packageSpec;
@@ -16,5 +17,7 @@ fs.renameSync(rescriptPackagePath, rescriptArtifactName);
1617
fs.renameSync(stdlibPackagePath, stdlibArtifactName);
1718

1819
// Pass information to subsequent GitHub actions
19-
console.log(`::set-output name=rescript_package::${rescriptArtifactName}`);
20-
console.log(`::set-output name=stdlib_package::${stdlibArtifactName}`);
20+
fs.appendFileSync(
21+
process.env.GITHUB_ENV,
22+
`rescript_package=${rescriptArtifactName}${os.EOL}stdlib_package=${stdlibArtifactName}${os.EOL}`
23+
);

CHANGELOG.md

+55-1
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,72 @@
2424
- 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*.
2525
- 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.
2626

27+
# 10.1.0-rc.3
28+
29+
#### :rocket: New Feature
30+
31+
- Support the use of spread anywhere in list creation (e.g. `list{...x, 1, ...y, ...z}`). https://github.com/rescript-lang/syntax/pull/692
32+
- Add support for the argument of `@react.component` to set a props type from the outside. https://github.com/rescript-lang/syntax/pull/699
33+
34+
#### :bug: Bug Fix
35+
36+
- Fix issue where the JSX key type is not an optional string https://github.com/rescript-lang/syntax/pull/693
37+
- Prevent inlining of async functions https://github.com/rescript-lang/rescript-compiler/issues/5754
38+
- Fix build error for JSX fragment without children https://github.com/rescript-lang/syntax/pull/704
39+
- Fix issue where async as an id cannot be used with application and labelled arguments https://github.com/rescript-lang/syntax/issues/707
40+
- Fix 5557: the exhaustive checking for char is incorrect during the unicode migration https://github.com/rescript-lang/rescript-compiler/pull/5749
41+
- Fix 5753: the comment for unicode char is inaccurate https://github.com/rescript-lang/syntax/pull/709
42+
- Treat await as almost-unary operator weaker than pipe so `await foo->bar` means `await (foo->bar)` https://github.com/rescript-lang/syntax/pull/711
43+
44+
#### :nail_care: Polish
45+
46+
- Change payload of `Pconst_char` from `char` to `int` https://github.com/rescript-lang/syntax/pull/709
47+
48+
# 10.1.0-rc.2
49+
50+
#### :bug: Bug Fix
51+
52+
- Fix issue with changes not being applied with React Native's Metro bundler for files with warnings https://github.com/rescript-lang/rescript-compiler/pull/5738
53+
- Fix emitting unary minus for floats in case of negative constants https://github.com/rescript-lang/rescript-compiler/pull/5737
54+
- Fix issue where a spread `...x` in non-last position would not be reported as syntax error https://github.com/rescript-lang/syntax/pull/673/
55+
- Fix issue where the formatter would delete `async` in a function with labelled arguments.
56+
- Fix several printing issues with `async` including an infinite loop https://github.com/rescript-lang/syntax/pull/680
57+
- Fix issue where certain JSX expressions would be formatted differenctly in compiler 10.1.0-rc.1 https://github.com/rescript-lang/syntax/issues/675
58+
- Fix issue where printing nested pipe discards await https://github.com/rescript-lang/syntax/issues/687
59+
2760
# 10.1.0-rc.1
2861

62+
#### :boom: Breaking Change
63+
64+
- Deprecate DOM element attributes in `JsxDOM.domProps`: `begin_`, `end_`, `to_`
65+
- Use `begin`, `end`, `to` instead.
66+
- Emit an error when a `@string` or `@int` attribute is used in a V4 component https://github.com/rescript-lang/rescript-compiler/issues/5724
67+
2968
## :rocket: New Feature
3069

3170
- Add extra variants for output filename suffixes in `bsconfig.json`: `.bs.mjs` and `.bs.cjs` are allowed https://github.com/rescript-lang/rescript-compiler/pull/5631
71+
- Safe promises: t-first Js.Promise2 bindings, and remove warning for nested promises https://github.com/rescript-lang/rescript-compiler/pull/5709
3272

3373
#### :bug: Bug Fix
3474

35-
- Fix printing of comments inside empty blocks https://github.com/rescript-lang/syntax/pull/647
75+
- Fix issue where uncurried async functions were emitted without `async` https://github.com/rescript-lang/rescript-compiler/pull/5718
3676
- Fix location issue in error messages with JSX V4 where the multiple props types are defined https://github.com/rescript-lang/syntax/pull/655
3777
- Fix location issue in make function in JSX V4 that breaks dead code elimination https://github.com/rescript-lang/syntax/pull/660
3878
- Fix parsing (hence pretty printing) of expressions with underscore `_` and comments.
79+
- Fix printing of comments inside JSX tag https://github.com/rescript-lang/syntax/pull/664
80+
- Fix issue where formatter erases tail comments inside JSX tag https://github.com/rescript-lang/syntax/issues/663
81+
- Fix issue where the JSX prop has type annotation of the first class module https://github.com/rescript-lang/syntax/pull/666
82+
- Fix issue where an empty record literal {} expected to have a non-record type would type check https://github.com/rescript-lang/rescript-compiler/pull/5729
83+
84+
#### :eyeglasses: Spec Compliance
85+
86+
- Functions with consecutive dots now print as multiple arrow functions like in JavaScript.
87+
88+
#### :nail_care: Polish
89+
90+
- Add `loading`, `aria-*` DOM element attributes in `JsxDOM.domProps`: `ariaCurrent`, `ariaInvalid`, `ariaAutocomplete`, etc.
91+
- Change the internal representation of props for the lowercase components to record. https://github.com/rescript-lang/syntax/pull/665
92+
- Add `JsxPPXReactSupport` module to relocate the helper functions for JSX v4 from `rescript-react`
3993

4094
# 10.1.0-alpha.2
4195

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ test-all: test test-gentype
2424
lib: build
2525
node scripts/install -force-lib-rebuild
2626

27+
artifacts: lib
28+
./scripts/makeArtifactList.js
29+
2730
clean-gentype:
2831
make -C jscomp/gentype_tests/typescript-react-example clean
2932

jscomp/core/js_dump.ml

+10-5
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ and expression_desc cxt ~(level : int) f x : cxt =
630630
match v with
631631
| Float { f } -> Js_number.caml_float_literal_to_js_string f
632632
(* attach string here for float constant folding?*)
633-
| Int { i; c = Some c } -> Format.asprintf "/* %C */%ld" c i
633+
| Int { i; c = Some c } -> Format.asprintf "/* %s */%ld" (Ext_util.string_of_int_as_char c) i
634634
| Int { i; c = None } ->
635635
Int32.to_string i
636636
(* check , js convention with ocaml lexical convention *)
@@ -666,7 +666,10 @@ and expression_desc cxt ~(level : int) f x : cxt =
666666
expression ~level:13 cxt f e
667667
| Bin
668668
( Minus,
669-
{ expression_desc = Number (Int { i = 0l; _ } | Float { f = "0." }) },
669+
{
670+
expression_desc =
671+
Number ((Int { i = 0l; _ } | Float { f = "0." }) as desc);
672+
},
670673
e )
671674
(* TODO:
672675
Handle multiple cases like
@@ -675,7 +678,7 @@ and expression_desc cxt ~(level : int) f x : cxt =
675678
{[ 0.000 - x ]}
676679
*) ->
677680
P.cond_paren_group f (level > 13) 1 (fun _ ->
678-
P.string f "-";
681+
P.string f (match desc with Float _ -> "- " | _ -> "-");
679682
expression ~level:13 cxt f e)
680683
| Bin (op, e1, e2) ->
681684
let out, lft, rght = Js_op_util.op_prec op in
@@ -718,8 +721,10 @@ and expression_desc cxt ~(level : int) f x : cxt =
718721
Js_op.Lit (Ext_ident.convert x))))
719722
(*name convention of Record is slight different from modules*)
720723
| Caml_block (el, mutable_flag, _, Blk_record { fields; record_repr }) -> (
721-
if Array.length fields <> 0 && Ext_array.for_alli fields (fun i v -> string_of_int i = v) then
722-
expression_desc cxt ~level f (Array (el, mutable_flag))
724+
if
725+
Array.length fields <> 0
726+
&& Ext_array.for_alli fields (fun i v -> string_of_int i = v)
727+
then expression_desc cxt ~level f (Array (el, mutable_flag))
723728
else
724729
match record_repr with
725730
| Record_regular ->

jscomp/core/js_exp_make.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ val method_ :
103103

104104
val econd : ?comment:string -> t -> t -> t -> t
105105

106-
val int : ?comment:string -> ?c:char -> int32 -> t
106+
val int : ?comment:string -> ?c:int -> int32 -> t
107107

108108
val uint32 : ?comment:string -> int32 -> t
109109

jscomp/core/js_implementation.ml

+76-73
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,41 @@ let process_with_gentype cmt_file =
4545
if !Clflags.bs_gentype then GenTypeMain.processCmtFile cmt_file
4646

4747
let after_parsing_sig ppf outputprefix ast =
48-
Ast_config.iter_on_bs_config_sigi ast;
49-
if !Js_config.modules then
50-
output_deps_set !Location.input_name
51-
(Ast_extract.read_parse_and_extract Mli ast);
52-
(if !Js_config.binary_ast then
53-
let sourcefile = !Location.input_name in
54-
Binary_ast.write_ast Mli ~sourcefile
55-
~output:(outputprefix ^ Literals.suffix_iast)
56-
(* to support relocate to another directory *)
57-
ast);
58-
if !Js_config.as_pp then (
59-
output_string stdout Config.ast_intf_magic_number;
60-
output_value stdout (!Location.input_name : string);
61-
output_value stdout ast);
62-
if !Js_config.syntax_only then Warnings.check_fatal ()
63-
else
64-
let modulename = module_of_filename outputprefix in
65-
Lam_compile_env.reset ();
66-
let initial_env = Res_compmisc.initial_env () in
67-
Env.set_unit_name modulename;
68-
let tsg = Typemod.transl_signature initial_env ast in
69-
if !Clflags.dump_typedtree then fprintf ppf "%a@." Printtyped.interface tsg;
70-
let sg = tsg.sig_type in
71-
ignore (Includemod.signatures initial_env sg sg);
72-
Delayed_checks.force_delayed_checks ();
73-
Warnings.check_fatal ();
74-
let deprecated = Builtin_attributes.deprecated_of_sig ast in
75-
let sg =
76-
Env.save_signature ~deprecated sg modulename (outputprefix ^ ".cmi")
77-
in
78-
Typemod.save_signature modulename tsg outputprefix !Location.input_name
79-
initial_env sg;
80-
process_with_gentype (outputprefix ^ ".cmti")
48+
if !Clflags.only_parse = false then (
49+
Ast_config.iter_on_bs_config_sigi ast;
50+
if !Js_config.modules then
51+
output_deps_set !Location.input_name
52+
(Ast_extract.read_parse_and_extract Mli ast);
53+
(if !Js_config.binary_ast then
54+
let sourcefile = !Location.input_name in
55+
Binary_ast.write_ast Mli ~sourcefile
56+
~output:(outputprefix ^ Literals.suffix_iast)
57+
(* to support relocate to another directory *)
58+
ast);
59+
if !Js_config.as_pp then (
60+
output_string stdout Config.ast_intf_magic_number;
61+
output_value stdout (!Location.input_name : string);
62+
output_value stdout ast);
63+
if !Js_config.syntax_only then Warnings.check_fatal ()
64+
else
65+
let modulename = module_of_filename outputprefix in
66+
Lam_compile_env.reset ();
67+
let initial_env = Res_compmisc.initial_env () in
68+
Env.set_unit_name modulename;
69+
let tsg = Typemod.transl_signature initial_env ast in
70+
if !Clflags.dump_typedtree then
71+
fprintf ppf "%a@." Printtyped.interface tsg;
72+
let sg = tsg.sig_type in
73+
ignore (Includemod.signatures initial_env sg sg);
74+
Delayed_checks.force_delayed_checks ();
75+
Warnings.check_fatal ();
76+
let deprecated = Builtin_attributes.deprecated_of_sig ast in
77+
let sg =
78+
Env.save_signature ~deprecated sg modulename (outputprefix ^ ".cmi")
79+
in
80+
Typemod.save_signature modulename tsg outputprefix !Location.input_name
81+
initial_env sg;
82+
process_with_gentype (outputprefix ^ ".cmti"))
8183

8284
let interface ~parser ppf ?outputprefix fname =
8385
let outputprefix =
@@ -126,48 +128,49 @@ let no_export (rest : Parsetree.structure) : Parsetree.structure =
126128
| _ -> rest
127129

128130
let after_parsing_impl ppf outputprefix (ast : Parsetree.structure) =
129-
Js_config.all_module_aliases :=
130-
!Clflags.assume_no_mli = Mli_non_exists && all_module_alias ast;
131-
Ast_config.iter_on_bs_config_stru ast;
132-
let ast = if !Js_config.no_export then no_export ast else ast in
133-
if !Js_config.modules then
134-
output_deps_set !Location.input_name
135-
(Ast_extract.read_parse_and_extract Ml ast);
136-
(if !Js_config.binary_ast then
137-
let sourcefile = !Location.input_name in
138-
Binary_ast.write_ast ~sourcefile Ml
139-
~output:(outputprefix ^ Literals.suffix_ast)
140-
ast);
141-
if !Js_config.as_pp then (
142-
output_string stdout Config.ast_impl_magic_number;
143-
output_value stdout (!Location.input_name : string);
144-
output_value stdout ast);
145-
if !Js_config.syntax_only then Warnings.check_fatal ()
146-
else
147-
let modulename = Ext_filename.module_name outputprefix in
148-
Lam_compile_env.reset ();
149-
let env = Res_compmisc.initial_env () in
150-
Env.set_unit_name modulename;
151-
let typedtree, coercion, _, _ =
152-
Typemod.type_implementation_more
153-
?check_exists:(if !Js_config.force_cmi then None else Some ())
154-
!Location.input_name outputprefix modulename env ast
155-
in
156-
let typedtree_coercion = (typedtree, coercion) in
157-
print_if ppf Clflags.dump_typedtree Printtyped.implementation_with_coercion
158-
typedtree_coercion;
159-
(if !Js_config.cmi_only then Warnings.check_fatal ()
131+
if !Clflags.only_parse = false then (
132+
Js_config.all_module_aliases :=
133+
!Clflags.assume_no_mli = Mli_non_exists && all_module_alias ast;
134+
Ast_config.iter_on_bs_config_stru ast;
135+
let ast = if !Js_config.no_export then no_export ast else ast in
136+
if !Js_config.modules then
137+
output_deps_set !Location.input_name
138+
(Ast_extract.read_parse_and_extract Ml ast);
139+
(if !Js_config.binary_ast then
140+
let sourcefile = !Location.input_name in
141+
Binary_ast.write_ast ~sourcefile Ml
142+
~output:(outputprefix ^ Literals.suffix_ast)
143+
ast);
144+
if !Js_config.as_pp then (
145+
output_string stdout Config.ast_impl_magic_number;
146+
output_value stdout (!Location.input_name : string);
147+
output_value stdout ast);
148+
if !Js_config.syntax_only then Warnings.check_fatal ()
160149
else
161-
let lambda, exports =
162-
Translmod.transl_implementation modulename typedtree_coercion
163-
in
164-
let js_program =
165-
print_if_pipe ppf Clflags.dump_rawlambda Printlambda.lambda lambda
166-
|> Lam_compile_main.compile outputprefix exports
150+
let modulename = Ext_filename.module_name outputprefix in
151+
Lam_compile_env.reset ();
152+
let env = Res_compmisc.initial_env () in
153+
Env.set_unit_name modulename;
154+
let typedtree, coercion, _, _ =
155+
Typemod.type_implementation_more
156+
?check_exists:(if !Js_config.force_cmi then None else Some ())
157+
!Location.input_name outputprefix modulename env ast
167158
in
168-
if not !Js_config.cmj_only then
169-
Lam_compile_main.lambda_as_module js_program outputprefix);
170-
process_with_gentype (outputprefix ^ ".cmt")
159+
let typedtree_coercion = (typedtree, coercion) in
160+
print_if ppf Clflags.dump_typedtree
161+
Printtyped.implementation_with_coercion typedtree_coercion;
162+
(if !Js_config.cmi_only then Warnings.check_fatal ()
163+
else
164+
let lambda, exports =
165+
Translmod.transl_implementation modulename typedtree_coercion
166+
in
167+
let js_program =
168+
print_if_pipe ppf Clflags.dump_rawlambda Printlambda.lambda lambda
169+
|> Lam_compile_main.compile outputprefix exports
170+
in
171+
if not !Js_config.cmj_only then
172+
Lam_compile_main.lambda_as_module js_program outputprefix);
173+
process_with_gentype (outputprefix ^ ".cmt"))
171174

172175
let implementation ~parser ppf ?outputprefix fname =
173176
let outputprefix =

jscomp/core/js_of_lam_string.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module E = Js_exp_make
2929
currently, it follows the same patten of ocaml, [char] is [int]
3030
*)
3131

32-
let const_char (i : char) = E.int ~c:i (Int32.of_int @@ Char.code i)
32+
let const_char (i : int) = E.int ~c:i (Int32.of_int @@ i)
3333

3434
(* string [s[i]] expects to return a [ocaml_char] *)
3535
let ref_string e e1 = E.string_index e e1

jscomp/core/js_of_lam_string.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ val ref_byte : J.expression -> J.expression -> J.expression
3434

3535
val set_byte : J.expression -> J.expression -> J.expression -> J.expression
3636

37-
val const_char : char -> J.expression
37+
val const_char : int -> J.expression
3838

3939
val bytes_to_string : J.expression -> J.expression

jscomp/core/js_op.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ type float_lit = { f : string } [@@unboxed]
126126

127127
type number =
128128
| Float of float_lit
129-
| Int of { i : int32; c : char option }
129+
| Int of { i : int32; c : int option }
130130
| Uint of int32
131131

132132
(* becareful when constant folding +/-,

0 commit comments

Comments
 (0)