Skip to content

Commit 90ac36d

Browse files
committed
Merge branch 'master' into docstrings-before-type-expansions
2 parents 3900495 + 4c5ad57 commit 90ac36d

File tree

184 files changed

+3671
-3343
lines changed

Some content is hidden

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

184 files changed

+3671
-3343
lines changed

.github/workflows/ci.yml

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ jobs:
476476
run: .github/workflows/moveArtifacts.sh
477477
shell: bash
478478

479+
- name: Check artifact list
480+
run: node ./scripts/npmPack.js
481+
479482
- name: Publish packages to pkg.pr.new
480483
run: |
481484
yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
@@ -522,7 +525,7 @@ jobs:
522525
git commit -m "Update API docs for ${{ github.ref_name }}"
523526
git push
524527
525-
test-integration:
528+
test-installation-npm:
526529
needs:
527530
- pkg-pr-new
528531
strategy:
@@ -573,6 +576,86 @@ jobs:
573576
shell: bash
574577
working-directory: ${{ steps.tmp-dir.outputs.path }}
575578

579+
test-installation-pnpm:
580+
needs:
581+
- pkg-pr-new
582+
strategy:
583+
fail-fast: false
584+
matrix:
585+
include:
586+
- os: macos-13
587+
- os: macos-14
588+
- os: ubuntu-24.04
589+
- os: ubuntu-24.04-arm
590+
- os: windows-latest
591+
runs-on: ${{ matrix.os }}
592+
env:
593+
RUST_BACKTRACE: "1"
594+
steps:
595+
- name: Install pnpm
596+
uses: pnpm/action-setup@v4
597+
with:
598+
version: 10
599+
600+
- name: Use Node.js
601+
uses: actions/setup-node@v4
602+
with:
603+
# Run integration tests with the oldest supported node version.
604+
node-version: 20
605+
606+
- name: Checkout
607+
uses: actions/checkout@v4
608+
609+
- name: Make test directory
610+
id: tmp-dir
611+
shell: bash
612+
run: |
613+
if [[ "$RUNNER_OS" == "Windows" ]]; then
614+
dir=$(powershell -Command "[System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()" | tr -d '\r')
615+
mkdir -p "$dir"
616+
else
617+
dir=$(mktemp -d)
618+
fi
619+
echo "path=$dir" >> "$GITHUB_OUTPUT"
620+
cp -r tests/package_tests/installation_test/* "$dir"
621+
622+
- name: Install ReScript package
623+
run: |
624+
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
625+
pnpm i "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
626+
shell: bash
627+
working-directory: ${{ steps.tmp-dir.outputs.path }}
628+
629+
- name: Test installation
630+
run: pnpm rescript -h && pnpm rescript legacy build && cat src/Test.res.js
631+
shell: bash
632+
working-directory: ${{ steps.tmp-dir.outputs.path }}
633+
634+
test-integration-rewatch:
635+
needs:
636+
- pkg-pr-new
637+
strategy:
638+
fail-fast: false
639+
matrix:
640+
include:
641+
- os: macos-13
642+
- os: macos-14
643+
- os: ubuntu-24.04
644+
- os: ubuntu-24.04-arm
645+
- os: windows-latest
646+
runs-on: ${{ matrix.os }}
647+
env:
648+
RUST_BACKTRACE: "1"
649+
steps:
650+
- name: Checkout
651+
uses: actions/checkout@v4
652+
653+
- name: Use Node.js
654+
uses: actions/setup-node@v4
655+
with:
656+
# Run integration tests with the oldest supported node version.
657+
node-version: 20
658+
576659
- name: Install ReScript package in rewatch/testrepo
577660
run: |
578661
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
@@ -586,7 +669,9 @@ jobs:
586669

587670
publish:
588671
needs:
589-
- test-integration
672+
- test-installation-npm
673+
- test-installation-pnpm
674+
- test-integration-rewatch
590675
if: startsWith(github.ref, 'refs/tags/v')
591676
runs-on: ubuntu-24.04-arm
592677
steps:

CHANGELOG.md

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,73 @@
77
> - :rocket: [New Feature]
88
> - :bug: [Bug Fix]
99
> - :memo: [Documentation]
10-
> - :house: [Internal]
1110
> - :nail_care: [Polish]
11+
> - :house: [Internal]
1212
13-
# 12.0.0-alpha.15 (Unreleased)
13+
# 12.0.0-beta.2 (Unreleased)
14+
15+
#### :nail_care: Polish
16+
17+
- Add missing backtick and spaces to `Belt.Map.map` doc comment. https://github.com/rescript-lang/rescript/pull/7632
18+
19+
#### :house: Internal
20+
21+
- Remove internal/unused `-bs-v` flag. https://github.com/rescript-lang/rescript/pull/7627
22+
- Remove unused `-bs-D` and `-bs-list-conditionals` flags. https://github.com/rescript-lang/rescript/pull/7631
23+
- Remove obsolete jsx options. https://github.com/rescript-lang/rescript/pull/7633
24+
- Remove obsolete option `-bs-unsafe-empty-array`. https://github.com/rescript-lang/rescript/pull/7635
25+
- Clean up `config.ml`. https://github.com/rescript-lang/rescript/pull/7636
26+
- Rewatch: simplify getting bsc path. https://github.com/rescript-lang/rescript/pull/7634
27+
28+
#### :rocket: New Feature
29+
30+
- Add experimental command to `rescript-tools` for extracting all ReScript code blocks from markdown, either a md-file directly, or inside of docstrings in ReScript code. https://github.com/rescript-lang/rescript/pull/7623
31+
32+
# 12.0.0-beta.1
33+
34+
#### :rocket: New Feature
35+
36+
- Add experimental command to `rescript-tools` for formatting all ReScript code blocks in markdown. Either in a markdown file directly, or inside of docstrings in ReScript code. https://github.com/rescript-lang/rescript/pull/7598
37+
- Add `String.getSymbolUnsafe` back to Stdlib. https://github.com/rescript-lang/rescript/pull/7626
38+
39+
#### :nail_care: Polish
40+
41+
- Add a warning if the name in package.json does not match the name in rescript.json. https://github.com/rescript-lang/rescript/pull/7604
42+
43+
#### :house: Internal
44+
45+
- Remove uncurried handling from rewatch. https://github.com/rescript-lang/rescript/pull/7625
46+
47+
# 12.0.0-alpha.15
1448

1549
#### :boom: Breaking Change
1650

1751
- New `rewatch` based build system. https://github.com/rescript-lang/rescript/pull/7551 https://github.com/rescript-lang/rescript/pull/7593
1852
- The new `rewatch` based build system is now the default and is exposed through the `rescript` command. The `rewatch` command has been removed.
1953
- The previous Ninja-based build system is now available via the `rescript legacy` subcommand.
2054
- Argument `--compiler-args` is now a subcommand `compiler-args`.
21-
- Remove `String.getSymbol` from standard library. https://github.com/rescript-lang/rescript/pull/7571
22-
- Remove `String.getSymbolUnsafe` from standard library. https://github.com/rescript-lang/rescript/pull/7571
23-
- Remove `String.setSymbol` from standard library. https://github.com/rescript-lang/rescript/pull/7571
55+
- Remove `String.getSymbol`, `String.getSymbolUnsafe`, `String.setSymbol` from standard library. https://github.com/rescript-lang/rescript/pull/7571
2456

25-
#### :rocket: New Feature
57+
#### :bug: Bug fix
58+
59+
- Ignore inferred arity in functions inside `%raw` functions, leaving to `%ffi` the responsibility to check the arity since it gives an error in case of mismatch. https://github.com/rescript-lang/rescript/pull/7542
60+
- Pass the rewatch exit code through in wrapper script. https://github.com/rescript-lang/rescript/pull/7565
61+
- Prop punning when types don't match results in `I/O error: _none_: No such file or directory`. https://github.com/rescript-lang/rescript/pull/7533
62+
- Pass location to children prop in jsx ppx. https://github.com/rescript-lang/rescript/pull/7540
63+
- Fix crash when `-bs-g` is used with untagged variants. https://github.com/rescript-lang/rescript/pull/7575
64+
- Fix issue with preserve mode where `jsx` is declared as an external without a `@module` attribute. https://github.com/rescript-lang/rescript/pull/7591
65+
- Rewatch: don't add deps to modules that are in packages that are not a dependency. https://github.com/rescript-lang/rescript/pull/7612
66+
- Rewatch: fix non-unicode stderr. https://github.com/rescript-lang/rescript/pull/7613
67+
- Fix rewatch considering warning configs of non-local dependencies. https://github.com/rescript-lang/rescript/pull/7614
68+
- Rewatch: fix panic if package.json name different from module name. https://github.com/rescript-lang/rescript/pull/7616
69+
- Fix finding the standard library for pnpm. https://github.com/rescript-lang/rescript/pull/7615
70+
71+
#### :nail_care: Polish
2672

73+
- Better error message for when trying to await something that is not a promise. https://github.com/rescript-lang/rescript/pull/7561
74+
- Better error messages for object field missing and object field type mismatches. https://github.com/rescript-lang/rescript/pull/7580
75+
- Better error messages for when polymorphic variants does not match for various reasons. https://github.com/rescript-lang/rescript/pull/7596
76+
- Improved completions for inline records. https://github.com/rescript-lang/rescript/pull/7601
2777
- Add `OrThrow` aliases for `Belt` functions ending with `Exn`. https://github.com/rescript-lang/rescript/pull/7581, https://github.com/rescript-lang/rescript/pull/7590 The following aliases have been added:
2878
- `Belt.Array.getOrThrow`
2979
- `Belt.Array.setOrThrow`
@@ -39,25 +89,10 @@
3989
- `Belt.Option.getOrThrow`
4090
- `Belt.Result.getOrThrow`
4191

42-
#### :bug: Bug fix
43-
44-
- Ignore inferred arity in functions inside `%raw` functions, leaving to `%ffi` the responsibility to check the arity since it gives an error in case of mismatch. https://github.com/rescript-lang/rescript/pull/7542
45-
- Pass the rewatch exit code through in wrapper script. https://github.com/rescript-lang/rescript/pull/7565
46-
- Prop punning when types don't match results in I/O error: _none_: No such file or directory. https://github.com/rescript-lang/rescript/pull/7533
47-
- Pass location to children prop in jsx ppx. https://github.com/rescript-lang/rescript/pull/7540
48-
- Fix crash when `bs-g` is used with untagged variants. https://github.com/rescript-lang/rescript/pull/7575
49-
- Fix issue with preserve mode where `jsx` is declared as an external without a `@module` attribute. https://github.com/rescript-lang/rescript/pull/7591
50-
51-
#### :nail_care: Polish
52-
53-
- Better error message for when trying to await something that is not a promise. https://github.com/rescript-lang/rescript/pull/7561
54-
- Better error messages for object field missing and object field type mismatches. https://github.com/rescript-lang/rescript/pull/7580
55-
- Better error messages for when polymorphic variants does not match for various reasons. https://github.com/rescript-lang/rescript/pull/7596
56-
- Improved completions for inline records. https://github.com/rescript-lang/rescript/pull/7601
57-
5892
#### :house: Internal
5993

6094
- Remove `@return(undefined_to_opt)` and `%undefined_to_opt` primitive. https://github.com/rescript-lang/rescript/pull/7462
95+
- Migrate rewatch to Rust 2024 edition. https://github.com/rescript-lang/rescript/pull/7602
6196

6297
# 12.0.0-alpha.14
6398

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The major contributions from contributors include
66

77
- `super_errors` from [Cheng](https://github.com/chenglou) and [Cristiano](https://github.com/cristianoc)
88
- `react_jsx_ppx` from [Ricky](https://github.com/rickyvetter)
9+
- `rewatch` (the new ReScript build system) from [Roland](https://github.com/rolandpeelen) and [Jaap](https://github.com/jfrolich)
910

1011
Cristiano also contributed to several important patches in the upstream native compiler,
1112
in particular, the pattern match compilation.

analysis/examples/example-project/bsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"number": "-32-26-27-33"
77
},
88
"bs-dependencies": ["reason-react"],
9-
"reason": { "react-jsx": 3 },
109
"namespace": "my-namespace",
1110
"reanalyze": {
1211
"analysis": ["dce", "exception"]

analysis/examples/larger-project/bsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
},
77
"name": "sample-typescript-app",
88
"bsc-flags": ["-bs-super-errors -w a"],
9-
"reason": { "react-jsx": 3 },
109
"bs-dependencies": ["@rescript/react", "@glennsl/bs-json"],
1110
"sources": [
1211
{

analysis/src/Commands.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,13 @@ let format ~path =
282282
~filename:path
283283
in
284284
if List.length diagnostics > 0 then ""
285-
else
286-
Res_printer.print_implementation
287-
~width:Res_multi_printer.default_print_width ~comments structure
285+
else Res_printer.print_implementation ~comments structure
288286
else if Filename.check_suffix path ".resi" then
289287
let {Res_driver.parsetree = signature; comments; diagnostics} =
290288
Res_driver.parsing_engine.parse_interface ~for_printer:true ~filename:path
291289
in
292290
if List.length diagnostics > 0 then ""
293-
else
294-
Res_printer.print_interface ~width:Res_multi_printer.default_print_width
295-
~comments signature
291+
else Res_printer.print_interface ~comments signature
296292
else ""
297293

298294
let diagnosticSyntax ~path =

analysis/src/CreateInterface.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let printSignature ~extractor ~signature =
102102
Printtyp.reset_names ();
103103
let sigItemToString (item : Outcometree.out_sig_item) =
104104
item |> Res_outcome_printer.print_out_sig_item_doc
105-
|> Res_doc.to_string ~width:Res_multi_printer.default_print_width
105+
|> Res_doc.to_string ~width:Res_printer.default_print_width
106106
in
107107

108108
let genSigStrForInlineAttr lines attributes id vd =

analysis/src/Protocol.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ let optWrapInQuotes s =
137137
| None -> None
138138
| Some s -> Some (wrapInQuotes s)
139139

140+
let stringifyResult = function
141+
| Ok r -> stringifyObject [("TAG", Some (wrapInQuotes "Ok")); ("_0", Some r)]
142+
| Error e ->
143+
stringifyObject [("TAG", Some (wrapInQuotes "Error")); ("_0", Some e)]
144+
140145
let stringifyCompletionItem c =
141146
stringifyObject
142147
[

analysis/src/Shared.ml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ let tryReadCmt cmt =
55
else
66
match Cmt_format.read_cmt cmt with
77
| exception Cmi_format.Error err ->
8-
Log.log
9-
("Failed to load " ^ cmt ^ " as a cmt w/ ocaml version " ^ "406"
10-
^ ", error: "
11-
^
12-
(Cmi_format.report_error Format.str_formatter err;
13-
Format.flush_str_formatter ()));
8+
let error_message =
9+
Cmi_format.report_error Format.str_formatter err;
10+
Format.flush_str_formatter ()
11+
in
12+
Log.log ("Invalid cmt format " ^ cmt ^ ": " ^ error_message);
1413
None
1514
| exception err ->
16-
Log.log
17-
("Invalid cmt format " ^ cmt
18-
^ " - probably wrong ocaml version, expected " ^ Config.version ^ " : "
19-
^ Printexc.to_string err);
15+
Log.log ("Invalid cmt format " ^ cmt ^ ": " ^ Printexc.to_string err);
2016
None
2117
| x -> Some x
2218

analysis/src/Xform.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,6 @@ let parseImplementation ~filename =
855855
let structure = [Ast_helper.Str.eval ~loc:expr.pexp_loc expr] in
856856
structure
857857
|> Res_printer.print_implementation
858-
~width:Res_multi_printer.default_print_width
859858
~comments:(comments |> filterComments ~loc:expr.pexp_loc)
860859
|> Utils.indent range.start.character
861860
in
@@ -864,14 +863,12 @@ let parseImplementation ~filename =
864863
let structure = [item] in
865864
structure
866865
|> Res_printer.print_implementation
867-
~width:Res_multi_printer.default_print_width
868866
~comments:(comments |> filterComments ~loc:item.pstr_loc)
869867
|> Utils.indent range.start.character
870868
in
871869
let printStandaloneStructure ~(loc : Location.t) structure =
872870
structure
873871
|> Res_printer.print_implementation
874-
~width:Res_multi_printer.default_print_width
875872
~comments:(comments |> filterComments ~loc)
876873
in
877874
(structure, printExpr, printStructureItem, printStandaloneStructure)
@@ -891,7 +888,7 @@ let parseInterface ~filename =
891888
(item : Parsetree.signature_item) =
892889
let signature_item = [item] in
893890
signature_item
894-
|> Res_printer.print_interface ~width:Res_multi_printer.default_print_width
891+
|> Res_printer.print_interface
895892
~comments:(comments |> filterComments ~loc:item.psig_loc)
896893
|> Utils.indent range.start.character
897894
in

0 commit comments

Comments
 (0)