Skip to content

Commit 44c2102

Browse files
committed
Merge branch 'master' into group-jsx-modules
2 parents a4b46b0 + bece9c7 commit 44c2102

File tree

215 files changed

+3092
-3974
lines changed

Some content is hidden

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

215 files changed

+3092
-3974
lines changed

CHANGELOG.md

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

1717
- Rename `JsError` to `JsExn` and error modules cleanup. https://github.com/rescript-lang/rescript/pull/7408
18+
- Make `BigInt.fromFloat` return an option rather than throwing an error in case it's passed a value with a decimal value. https://github.com/rescript-lang/rescript/pull/7419
1819

1920
#### :rocket: New Feature
2021

2122
- Add shift (`<<`, `>>`, `>>>`) operators for `int` and `bigint`. https://github.com/rescript-lang/rescript/pull/7183
23+
- Add bitwise AND (`&`) operator for `int` and `bigint`. https://github.com/rescript-lang/rescript/pull/7415
24+
- Add bitwise NOT (`~`) operator for `int` and `bigint`. https://github.com/rescript-lang/rescript/pull/7418
2225
- Significantly reduced the download size by splitting binaries into optional platform-specific dependencies (e.g, `@rescript/linux-x64`). https://github.com/rescript-lang/rescript/pull/7395
26+
- JSX: do not error on ref as prop anymore (which is allowed in React 19). https://github.com/rescript-lang/rescript/pull/7420
2327

2428
#### :bug: Bug fix
2529

2630
- Fix broken `bstracing` CLI location. https://github.com/rescript-lang/rescript/pull/7398
31+
- Fix field flattening optimization to avoid creating unnecessary copies of allocating constants. https://github.com/rescript-lang/rescript-compiler/pull/7421
32+
- Fix leading comments removed when braces inside JSX contains `let` assignment. https://github.com/rescript-lang/rescript/pull/7424
33+
- Fix JSON escaping in code editor analysis: JSON was not always escaped properly, which prevented code actions from being available in certain situations https://github.com/rescript-lang/rescript/pull/7435
34+
- Fix regression in pattern matching for optional fields containing variants. https://github.com/rescript-lang/rescript/pull/7440
35+
- Fix missing checks for duplicate literals in variants with payloads. https://github.com/rescript-lang/rescript/pull/7441
36+
- Fix printer removing private for empty record. https://github.com/rescript-lang/rescript/pull/7448
2737

2838
#### :house: Internal
2939

3040
- AST: Add bar location to `case`. https://github.com/rescript-lang/rescript/pull/7407
3141

42+
#### :nail_care: Polish
43+
44+
- In type errors, recommend stdlib over Belt functions for converting between float/int/string. https://github.com/rescript-lang/rescript/pull/7453
45+
- Make `Jsx.element` a private empty record to avoid unnecessary `Primitive_option.some`. https://github.com/rescript-lang/rescript/pull/7450
46+
- Remove unused type `Jsx.ref`. https://github.com/rescript-lang/rescript/pull/7459
47+
3248
# 12.0.0-alpha.12
3349

3450
#### :bug: Bug fix
@@ -41,6 +57,7 @@
4157
#### :house: Internal
4258

4359
- Better representation of JSX in AST. https://github.com/rescript-lang/rescript/pull/7286
60+
- Clean up default warnings. https://github.com/rescript-lang/rescript/pull/7413
4461

4562
#### :nail_care: Polish
4663

analysis/reanalyze/src/Paths.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module Config = struct
8181
| Some False -> RunConfig.transitive false
8282
| _ -> ()
8383

84-
(* Read the config from rescript.json/bsconfig.json and apply it to runConfig and suppress and unsuppress *)
84+
(* Read the config from rescript.json and apply it to runConfig and suppress and unsuppress *)
8585
let processBsconfig () =
8686
Lazy.force setReScriptProjectRoot;
8787
let rescriptFile = Filename.concat runConfig.projectRoot rescriptJson in

analysis/reanalyze/src/Reanalyze.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ let cli () =
139139
"root_path Run all the analyses for all the .cmt files under the root \
140140
path" );
141141
("-ci", Unit (fun () -> Cli.ci := true), "Internal flag for use in CI");
142-
( "-config",
143-
Unit setConfig,
144-
"Read the analysis mode from rescript.json/bsconfig.json" );
142+
("-config", Unit setConfig, "Read the analysis mode from rescript.json");
145143
("-dce", Unit (fun () -> setDCE None), "Eperimental DCE");
146144
("-debug", Unit (fun () -> Cli.debug := true), "Print debug information");
147145
( "-dce-cmt",

analysis/src/CompletionDecorators.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Example `@raises(Exn)` or `@raises([E1, E2, E3])` for multiple exceptions.
164164

165165
You will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.
166166

167-
Note: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json`/`bsconfig.json` to enable the required React transformations.
167+
Note: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.
168168

169169
[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator).|};
170170
] );

analysis/src/CompletionFrontEnd.ml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,33 +267,35 @@ let rec exprToContextPathInner ~(inJsxContext : bool) (e : Parsetree.expression)
267267
};
268268
args =
269269
[(_, lhs); (_, {pexp_desc = Pexp_apply {funct = d; args; partial}})];
270+
transformed_jsx;
270271
} ->
271272
(* Transform away pipe with apply call *)
272273
exprToContextPath ~inJsxContext
273274
{
274275
pexp_desc =
275-
Pexp_apply {funct = d; args = (Nolabel, lhs) :: args; partial};
276+
Pexp_apply
277+
{funct = d; args = (Nolabel, lhs) :: args; partial; transformed_jsx};
276278
pexp_loc;
277279
pexp_attributes;
278280
}
279281
| Pexp_apply
280-
{
281-
funct = {pexp_desc = Pexp_ident {txt = Lident "->"}};
282-
args =
283-
[
284-
(_, lhs); (_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes});
285-
];
286-
partial;
287-
} ->
282+
({
283+
funct = {pexp_desc = Pexp_ident {txt = Lident "->"}};
284+
args =
285+
[
286+
(_, lhs);
287+
(_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes});
288+
];
289+
} as app) ->
288290
(* Transform away pipe with identifier *)
289291
exprToContextPath ~inJsxContext
290292
{
291293
pexp_desc =
292294
Pexp_apply
293295
{
296+
app with
294297
funct = {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes};
295298
args = [(Nolabel, lhs)];
296-
partial;
297299
};
298300
pexp_loc;
299301
pexp_attributes;

analysis/vendor/json/Json.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ let escape text =
141141
| '\b' -> Buffer.add_string buf "\\b"
142142
| '\r' -> Buffer.add_string buf "\\r"
143143
| '\t' -> Buffer.add_string buf "\\t"
144-
| c -> Buffer.add_char buf c);
144+
| c ->
145+
let code = Char.code c in
146+
if code < 0x20 then Printf.bprintf buf "\\u%04x" code
147+
else Buffer.add_char buf c);
145148
loop (i + 1))
146149
in
147150
loop 0;

compiler/bsb/bsb_build_util.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
172172
"package name is expected to be %s but got %s" s str);
173173
str
174174
| Some _ | None ->
175-
Bsb_exception.errorf ~loc "package name missing in %s/bsconfig.json" dir
175+
Bsb_exception.errorf ~loc "package name missing in %s/rescript.json" dir
176176
in
177177
if Ext_list.mem_string paths cur_package_name then (
178178
Bsb_log.error "@{<error>Cyclic dependencies in package stack@}@.";

compiler/bsb/bsb_build_util.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ val include_dirs_by : 'a list -> ('a -> string) -> string
5757
val mkp : string -> unit
5858

5959
(* The path of [bsc] and [bsdep] is normalized so that the invokation of [./compiler/bin/bsb.exe]
60-
and [bsb.exe] (combined with a dirty bsconfig.json) will not trigger unnecessary rebuild.
60+
and [bsb.exe] (combined with a dirty rescript.json) will not trigger unnecessary rebuild.
6161
6262
The location of [bsc] and [bsdep] is configured by the combination of [Sys.executable_name]
6363
and [cwd].

compiler/bsb/bsb_exception.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ let print (fmt : Format.formatter) (x : error) =
4949
let name = Bsb_pkg_types.to_string name in
5050
if Ext_string.equal name !Bs_version.package_name then
5151
Format.fprintf fmt
52-
"File \"bsconfig.json\", line 1\n\
52+
"File \"rescript.json\", line 1\n\
5353
@{<error>Error:@} package @{<error>%s@} is not found\n\
5454
It's the basic, required package. If you have it installed globally,\n\
5555
Please run `npm link rescript` to make it available"
5656
name
5757
else
5858
Format.fprintf fmt
59-
"File \"bsconfig.json\", line 1\n\
59+
"File \"rescript.json\", line 1\n\
6060
@{<error>Error:@} package @{<error>%s@} not found or built\n\
6161
- Did you install it?"
6262
name
@@ -68,7 +68,7 @@ let print (fmt : Format.formatter) (x : error) =
6868
https://rescript-lang.org/docs/manual/latest/build-configuration-schema"
6969
pos.pos_fname pos.pos_lnum s
7070
| Invalid_spec s ->
71-
Format.fprintf fmt "@{<error>Error: Invalid bsconfig.json %s@}" s
71+
Format.fprintf fmt "@{<error>Error: Invalid rescript.json: %s@}" s
7272

7373
let conflict_module modname dir1 dir2 =
7474
Error (Conflict_module (modname, dir1, dir2))

compiler/bsb/bsb_ninja_rule.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ type builtin = {
5656
(** rules are generally composed of built-in rules and customized rules, there are two design choices:
5757
1. respect custom rules with the same name, then we need adjust our built-in
5858
rules dynamically in case the conflict.
59-
2. respect our built-in rules, then we only need re-load custom rules for each bsconfig.json
59+
2. respect our built-in rules, then we only need re-load custom rules for each rescript.json
6060
*)
6161

6262
type command = string
6363

64-
(* Since now we generate ninja files per bsconfig.json in a single process,
64+
(* Since now we generate ninja files per rescript.json in a single process,
6565
we must make sure it is re-entrant
6666
*)
6767
val make_custom_rules :

0 commit comments

Comments
 (0)