Skip to content

Commit 88b0483

Browse files
authored
Merge branch 'master' into moar-rewatch-tests
2 parents 1287dd3 + 1cd4744 commit 88b0483

File tree

468 files changed

+15436
-30959
lines changed

Some content is hidden

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

468 files changed

+15436
-30959
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ jobs:
674674
shell: bash
675675

676676
publish:
677+
permissions:
678+
id-token: write
677679
needs:
678680
- test-installation-npm
679681
- test-installation-pnpm
@@ -701,11 +703,9 @@ jobs:
701703
shell: bash
702704

703705
- name: Publish packages on npm with tag "ci"
704-
env:
705-
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
706706
run: |
707707
yarn workspaces foreach -W --no-private \
708-
npm publish --tolerate-republish --tag ci
708+
npm publish --provenance --tolerate-republish --tag ci
709709
710710
- name: Update Website Playground
711711
run: curl -X POST "${{ secrets.CLOUDFLARE_PAGES_DEPLOYMENT_HOOK }}"

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,33 @@
1414

1515
#### :boom: Breaking Change
1616

17+
- Fix return type of `String.charCodeAt`. https://github.com/rescript-lang/rescript/pull/7864
18+
- Remove support of JSX children spread. https://github.com/rescript-lang/rescript/pull/7869
19+
1720
#### :eyeglasses: Spec Compliance
1821

1922
#### :rocket: New Feature
2023

24+
- Add `Array.filterMapWithIndex` to Stdlib. https://github.com/rescript-lang/rescript/pull/7876
25+
2126
#### :bug: Bug fix
2227

2328
- Fix code generation for emojis in polyvars and labels. https://github.com/rescript-lang/rescript/pull/7853
29+
- Add `reset` to `experimental_features` to correctly reset playground. https://github.com/rescript-lang/rescript/pull/7868
30+
- Fix crash with `@get` on external of type `unit => 'a`. https://github.com/rescript-lang/rescript/pull/7866
31+
- Fix record type spreads in inline records. https://github.com/rescript-lang/rescript/pull/7859
2432

2533
#### :memo: Documentation
2634

2735
#### :nail_care: Polish
2836

37+
- Reactivate optimization for length of array literals. https://github.com/rescript-lang/rescript/pull/7872
38+
- `Float.isNaN`: use `Number.isNaN` instead of global `isNaN`. https://github.com/rescript-lang/rescript/pull/7874
39+
2940
#### :house: Internal
3041

42+
- Playground: Add config options for experimental features and jsx preserve mode. https://github.com/rescript-lang/rescript/pull/7865
43+
- Clean up tests. https://github.com/rescript-lang/rescript/pull/7861 https://github.com/rescript-lang/rescript/pull/7871
3144
- Add `-runtime-path` flag to `bsc` (and `bsb`), we are detecting the location of `@rescript/runtime` in `cli/rescript.js` based on runtime module resolution. https://github.com/rescript-lang/rescript/pull/7858
3245

3346
# 12.0.0-beta.10

CONTRIBUTING.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,23 @@ Below we will discuss on how to write, build and run these test files.
227227
- Inside the file, add a mocha test suite. The mocha bindings are defined in `tests/tests/src/mt.res`. To get you started, here is a simple scaffold for a test suite with multiple test cases:
228228

229229
```rescript
230-
let suites: Mt.pair_suites = list{
231-
("hey", _ => Eq(true, 3 > 2)),
232-
("hi", _ => Neq(2, 3)),
233-
("hello", _ => Approx(3.0, 3.0)),
234-
("throw", _ => ThrowAny(_ => raise(SomeException))),
235-
}
236-
237-
Mt.from_pair_suites(__MODULE__, suites)
230+
open Mocha
231+
open Test_utils
232+
233+
describe(__MODULE__, () => {
234+
test("hey", () => {
235+
ok(__LOC__, 3 > 2)
236+
})
237+
238+
test("hi", () => {
239+
eq(__LOC__, 2, 2)
240+
eq(__LOC__, 3, 3)
241+
})
242+
243+
test("throw", () => {
244+
throws(__LOC__, () => throw(SomeException))
245+
})
246+
})
238247
```
239248

240249
- Build the test files and run the tests: `node scripts/test.js -mocha`.

analysis/src/CompletionFrontEnd.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
13531353
(Jsx_container_element
13541354
{jsx_container_element_children = children}) ->
13551355
children
1356-
| _ -> JSXChildrenItems []
1356+
| _ -> []
13571357
in
13581358
let compName_loc = compName.loc in
13591359
let compName_lid =
@@ -1412,8 +1412,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
14121412
(Jsx_container_element
14131413
{
14141414
jsx_container_element_closing_tag = None;
1415-
jsx_container_element_children =
1416-
JSXChildrenSpreading _ | JSXChildrenItems (_ :: _);
1415+
jsx_container_element_children = _ :: _;
14171416
}) ) ->
14181417
None
14191418
| Some jsxProps, _ ->

analysis/src/CompletionJsx.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ let extractJsxProps ~(compName : Longident.t Location.loc) ~props ~children =
460460
let open Parsetree in
461461
let childrenStart =
462462
match children with
463-
| JSXChildrenItems [] -> None
464-
| JSXChildrenSpreading child | JSXChildrenItems (child :: _) ->
463+
| [] -> None
464+
| child :: _ ->
465465
if child.pexp_loc.loc_ghost then None else Some (Loc.start child.pexp_loc)
466466
in
467467
let props =

analysis/src/SemanticTokens.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,7 @@ let command ~debug ~emitter ~path =
311311
~pos:(Pos.ofLexing posOfGreatherthanAfterProps);
312312

313313
(* children *)
314-
(match children with
315-
| Parsetree.JSXChildrenSpreading child -> iterator.expr iterator child
316-
| Parsetree.JSXChildrenItems children ->
317-
List.iter (iterator.expr iterator) children);
314+
List.iter (iterator.expr iterator) children;
318315

319316
(* closing tag *)
320317
closing_tag_opt

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"rewatch/**",
6666
"lib/es6/**",
6767
"lib/js/**",
68+
"lib/bs/**",
6869
"ninja/**",
6970
"playground/**",
7071
"*.bs.js",

compiler/core/lam_compile_external_call.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,11 @@ let translate_ffi ?(transformed_jsx = false) (cxt : Lam_compile_context.t)
421421
| [obj] ->
422422
let obj = translate_scoped_access scopes obj in
423423
E.dot obj name
424-
| _ -> assert false
424+
| _ ->
425+
(* This should have been caught in the frontend validation. *)
426+
invalid_arg
427+
"Internal compiler error: @get external called with wrong number of \
428+
arguments. Expected exactly one object argument."
425429
(* Note these assertion happens in call site *))
426430
| Js_set {js_set_name = name; js_set_scopes = scopes} -> (
427431
(* assert (js_splice = false) ; *)

compiler/frontend/ast_external_process.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,12 @@ let external_desc_of_non_obj (loc : Location.t) (st : external_desc)
899899
tagged_template = _;
900900
} ->
901901
if arg_type_specs_length = 1 then
902-
Js_get {js_get_name = name; js_get_scopes = scopes}
902+
(* Check if the first argument is unit, which is invalid for @get *)
903+
match arg_type_specs with
904+
| [{arg_type = Extern_unit}] ->
905+
Location.raise_errorf ~loc
906+
"Ill defined attribute %@get (unit argument is not allowed)"
907+
| _ -> Js_get {js_get_name = name; js_get_scopes = scopes}
903908
else
904909
Location.raise_errorf ~loc
905910
"Ill defined attribute %@get (only one argument)"

compiler/frontend/bs_ast_mapper.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ module M = struct
292292
end
293293

294294
module E = struct
295-
let map_jsx_children sub = function
296-
| JSXChildrenSpreading e -> JSXChildrenSpreading (sub.expr sub e)
297-
| JSXChildrenItems xs -> JSXChildrenItems (List.map (sub.expr sub) xs)
295+
let map_jsx_children sub xs = List.map (sub.expr sub) xs
298296

299297
let map_jsx_prop sub = function
300298
| JSXPropPunning (optional, name) ->

0 commit comments

Comments
 (0)