Skip to content

Commit 6a04d52

Browse files
committed
Merge branch 'master' into rewatch-lsp
2 parents 7611683 + 80b3811 commit 6a04d52

File tree

167 files changed

+1379
-3199
lines changed

Some content is hidden

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

167 files changed

+1379
-3199
lines changed

.github/workflows/branch_cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
# ignore-branches: ""
1818
ignored-prefixes: "maintenance/"
1919
last-commit-age-days: 90
20-
dry-run: true
20+
dry-run: false
2121
rate-limit: true

.github/workflows/ci.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ jobs:
419419
pkg-pr-new:
420420
needs:
421421
- build-compiler
422+
outputs:
423+
commit_sha: ${{ steps.publish.outputs.sha }}
422424
runs-on: ubuntu-24.04-arm
423425
steps:
424426
- name: Checkout
@@ -445,6 +447,7 @@ jobs:
445447
git diff --exit-code packages/artifacts.json
446448
447449
- name: Publish packages to pkg.pr.new
450+
id: publish
448451
run: |
449452
yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
450453
@@ -546,9 +549,9 @@ jobs:
546549
547550
- name: Install ReScript package
548551
run: |
549-
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
552+
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
550553
npm i --no-audit \
551-
"https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
554+
"https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
552555
shell: bash
553556
working-directory: ${{ steps.tmp-dir.outputs.path }}
554557

@@ -600,8 +603,8 @@ jobs:
600603
601604
- name: Install ReScript package
602605
run: |
603-
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
604-
pnpm i "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
606+
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
607+
pnpm i "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
605608
shell: bash
606609
working-directory: ${{ steps.tmp-dir.outputs.path }}
607610

@@ -638,8 +641,8 @@ jobs:
638641

639642
- name: Install ReScript package in test fixture
640643
run: |
641-
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
642-
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
644+
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
645+
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
643646
shell: bash
644647
working-directory: tests/rewatch_tests/fixture
645648

CHANGELOG.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
> - :nail_care: [Polish]
1111
> - :house: [Internal]
1212
13-
# 13.0.0-alpha.2 (Unreleased)
13+
# 13.0.0-alpha.3 (Unreleased)
1414

1515
#### :boom: Breaking Change
1616

@@ -20,17 +20,28 @@
2020

2121
#### :bug: Bug fix
2222

23+
- Reanalyze server: invalidate cache and recompute results when config changes in `rescript.json`. https://github.com/rescript-lang/rescript/pull/8262
24+
2325
#### :memo: Documentation
2426

2527
#### :nail_care: Polish
2628

29+
#### :house: Internal
30+
31+
# 13.0.0-alpha.2
32+
33+
#### :bug: Bug fix
34+
35+
- Fix compiler crash (`Fatal error: Parmatch.all_record_args`) when matching empty dict/record patterns. https://github.com/rescript-lang/rescript/pull/8246
36+
- Fix `null` falling into the object branch instead of the wildcard when pattern matching on untagged variants with both `Object` and `null` cases. https://github.com/rescript-lang/rescript/pull/8253
37+
38+
#### :nail_care: Polish
39+
2740
- Build system: Watch only source folders from build state instead of the entire project directory, and report missing configured source folders. https://github.com/rescript-lang/rescript/pull/8219
28-
- Build system: Add OpenTelemetry tracing support for cli commands. https://github.com/rescript-lang/rescript/pull/8241
2941

3042
#### :house: Internal
3143

32-
- speed up dev container test by installing ocaml in docker image instead of in `postCreate.sh`. https://github.com/rescript-lang/rescript/pull/8230
33-
- Migrate rewatch integration tests from bash scripts to Vitest and remove old test infrastructure. https://github.com/rescript-lang/rescript/pull/8241
44+
- Speed up dev container test by installing OCaml in docker image instead of in `postCreate.sh`. https://github.com/rescript-lang/rescript/pull/8230
3445

3546
# 13.0.0-alpha.1
3647

@@ -53,6 +64,7 @@
5364
#### :rocket: New Feature
5465

5566
- Reanalyze: add scoped `@@live`/`@@dead` annotations for marking module/file sections as live or dead. https://github.com/rescript-lang/rescript/pull/8197
67+
- Stdlib: Added Array.zip, Array.unzip, Array.zipBy, and Array.partition. https://github.com/rescript-lang/rescript/pull/8244
5668

5769
#### :bug: Bug fix
5870

LICENSE

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
Copyright (C) 2015-2016 Bloomberg Finance L.P.
2-
Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
1+
This repository contains code under multiple licenses.
32

4-
This program is free software: you can redistribute it and/or modify
5-
it under the terms of the GNU Lesser General Public License as published by
6-
the Free Software Foundation, either version 3 of the License, or
7-
(at your option) any later version.
3+
- compiler/: LGPL-3.0-or-later
4+
- compiler/syntax/: MIT
5+
- packages/@rescript/runtime/: MIT
6+
- rewatch/: MIT
87

9-
In addition to the permissions granted to you by the LGPL, you may combine
10-
or link a "work that uses the Library" with a publicly distributed version
11-
of this file to produce a combined library or application, then distribute
12-
that combined work under the terms of your choosing, with no requirement
13-
to comply with the obligations normally placed on you by section 4 of the
14-
LGPL version 3 (or the corresponding section of a later version of the LGPL
15-
should you choose to use a later version).
8+
See full license texts:
169

17-
This program is distributed in the hope that it will be useful,
18-
but WITHOUT ANY WARRANTY; without even the implied warranty of
19-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20-
GNU Lesser General Public License for more details.
21-
22-
You should have received a copy of the GNU Lesser General Public License
23-
along with this program; if not, write to the Free Software
24-
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10+
- LGPL-3.0-or-later: COPYING.LESSER (and COPYING where applicable)
11+
- MIT: LICENSE.MIT
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

3-
Copyright (c) 2020 - Authors of ReScript
3+
Copyright (c) 2015-2016 Bloomberg Finance L.P.
4+
Copyright (c) 2017- Hongbo Zhang, Authors of ReScript
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<p align="center">
1212
<a href="https://www.npmjs.org/package/rescript"><img src="https://img.shields.io/npm/v/rescript?color=brightgreen&label=npm%20package" alt="Current npm package version." /></a>
1313
<a href="https://github.com/rescript-lang/rescript/actions"><img src="https://github.com//rescript-lang/rescript/workflows/CI/badge.svg" alt="Current Github Actions workflow status." /></a>
14-
<a href="https://github.com/rescript-lang/rescript/blob/HEAD/LICENSE"><img src="https://img.shields.io/badge/License-LGPL%20v3-blue.svg" alt="ReScript is released under the LGPL license." /></a>
14+
<a href="https://github.com/rescript-lang/rescript/blob/HEAD/LICENSE"><img src="https://img.shields.io/badge/License-LGPL%20%2B%20MIT-blue.svg" alt="ReScript uses both LGPL and MIT licenses." /></a>
1515
<a href="https://x.com/intent/follow?screen_name=rescriptlang"><img src="https://img.shields.io/badge/X-000000?style=flat&logo=x&logoColor=white" alt="Follow @rescriptlang on X" /></a>
1616
<a href="https://bsky.app/profile/rescript-lang.org"><img src="https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff&style=flat" alt="Follow @rescriptlang on Bluesky" /></a>
1717
</p>
@@ -92,9 +92,14 @@ For discussions on ongoing development, see the [Development](https://forum.resc
9292

9393
## 📄 License
9494

95-
ReScript is licensed under LGPL version 3, with relaxed rules about creating and distributing combined work. See the [LICENSE](LICENSE) file for details.
95+
ReScript uses multiple licenses in this monorepo:
9696

97-
The ReScript parser (subdirectory `compiler/syntax`) is licensed under the [MIT License](compiler/syntax/LICENSE).
97+
- `compiler/`: LGPL-3.0-or-later
98+
- `compiler/syntax/`: MIT
99+
- `packages/@rescript/runtime/`: MIT
100+
- `rewatch/`: MIT
101+
102+
See the repository license index in [`LICENSE`](LICENSE) and full license texts in [`COPYING.LESSER`](COPYING.LESSER) and [`LICENSE.MIT`](LICENSE.MIT).
98103

99104
## 🏅 Acknowledgments
100105

analysis/reanalyze/src/ReanalyzeServer.ml

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ module Server = struct
9696
let s = Gc.quick_stat () in
9797
mb_of_words s.live_words
9898

99+
type reactive_pipeline = {
100+
dce_config: DceConfig.t;
101+
reactive_collection: ReactiveAnalysis.t;
102+
reactive_merge: ReactiveMerge.t;
103+
reactive_liveness: ReactiveLiveness.t;
104+
reactive_solver: ReactiveSolver.t;
105+
}
106+
99107
type server_state = {
100108
parse_argv: string array -> string option;
101109
run_analysis:
@@ -111,12 +119,9 @@ module Server = struct
111119
unit;
112120
config: server_config;
113121
cmtRoot: string option;
114-
dce_config: DceConfig.t;
115-
reactive_collection: ReactiveAnalysis.t;
116-
reactive_merge: ReactiveMerge.t;
117-
reactive_liveness: ReactiveLiveness.t;
118-
reactive_solver: ReactiveSolver.t;
122+
mutable pipeline: reactive_pipeline;
119123
stats: server_stats;
124+
mutable config_snapshot: RunConfig.snapshot;
120125
}
121126

122127
type request_info = {
@@ -261,6 +266,32 @@ Examples:
261266
unlink_if_exists stderr_path)
262267
run
263268

269+
let create_reactive_pipeline () : reactive_pipeline =
270+
let dce_config = DceConfig.current () in
271+
let reactive_collection = ReactiveAnalysis.create ~config:dce_config in
272+
let file_data_collection =
273+
ReactiveAnalysis.to_file_data_collection reactive_collection
274+
in
275+
let reactive_merge = ReactiveMerge.create file_data_collection in
276+
let reactive_liveness = ReactiveLiveness.create ~merged:reactive_merge in
277+
let value_refs_from =
278+
if dce_config.DceConfig.run.transitive then None
279+
else Some reactive_merge.ReactiveMerge.value_refs_from
280+
in
281+
let reactive_solver =
282+
ReactiveSolver.create ~decls:reactive_merge.ReactiveMerge.decls
283+
~live:reactive_liveness.ReactiveLiveness.live
284+
~annotations:reactive_merge.ReactiveMerge.annotations ~value_refs_from
285+
~config:dce_config
286+
in
287+
{
288+
dce_config;
289+
reactive_collection;
290+
reactive_merge;
291+
reactive_liveness;
292+
reactive_solver;
293+
}
294+
264295
let init_state ~(parse_argv : string array -> string option)
265296
~(run_analysis :
266297
dce_config:DceConfig.t ->
@@ -291,39 +322,16 @@ Examples:
291322
server with editor-like args only."
292323
!Cli.churn
293324
else
294-
let dce_config = DceConfig.current () in
295-
let reactive_collection =
296-
ReactiveAnalysis.create ~config:dce_config
297-
in
298-
let file_data_collection =
299-
ReactiveAnalysis.to_file_data_collection reactive_collection
300-
in
301-
let reactive_merge = ReactiveMerge.create file_data_collection in
302-
let reactive_liveness =
303-
ReactiveLiveness.create ~merged:reactive_merge
304-
in
305-
let value_refs_from =
306-
if dce_config.DceConfig.run.transitive then None
307-
else Some reactive_merge.ReactiveMerge.value_refs_from
308-
in
309-
let reactive_solver =
310-
ReactiveSolver.create ~decls:reactive_merge.ReactiveMerge.decls
311-
~live:reactive_liveness.ReactiveLiveness.live
312-
~annotations:reactive_merge.ReactiveMerge.annotations
313-
~value_refs_from ~config:dce_config
314-
in
325+
let pipeline = create_reactive_pipeline () in
315326
Ok
316327
{
317328
parse_argv;
318329
run_analysis;
319330
config;
320331
cmtRoot;
321-
dce_config;
322-
reactive_collection;
323-
reactive_merge;
324-
reactive_liveness;
325-
reactive_solver;
332+
pipeline;
326333
stats = {request_count = 0};
334+
config_snapshot = RunConfig.snapshot ();
327335
})
328336

329337
let run_one_request (state : server_state) (_req : request) :
@@ -347,6 +355,17 @@ Examples:
347355
(* Always run from the server's project root; client cwd is not stable in VS Code. *)
348356
state.config.cwd (fun () ->
349357
capture_stdout_stderr (fun () ->
358+
(* Re-read config from rescript.json to detect changes.
359+
If changed, recreate the entire reactive pipeline from scratch. *)
360+
RunConfig.reset ();
361+
Paths.Config.processConfig ();
362+
let new_snapshot = RunConfig.snapshot () in
363+
if
364+
not
365+
(RunConfig.equal_snapshot state.config_snapshot new_snapshot)
366+
then (
367+
state.pipeline <- create_reactive_pipeline ();
368+
state.config_snapshot <- new_snapshot);
350369
Log_.Color.setup ();
351370
Timing.enabled := !Cli.timing;
352371
Reactive.set_debug !Cli.timing;
@@ -357,18 +376,18 @@ Examples:
357376
(* Match direct CLI output (a leading newline before the JSON array). *)
358377
Printf.printf "\n";
359378
EmitJson.start ();
360-
state.run_analysis ~dce_config:state.dce_config
361-
~cmtRoot:state.cmtRoot
362-
~reactive_collection:(Some state.reactive_collection)
363-
~reactive_merge:(Some state.reactive_merge)
364-
~reactive_liveness:(Some state.reactive_liveness)
365-
~reactive_solver:(Some state.reactive_solver) ~skip_file:None
379+
let p = state.pipeline in
380+
state.run_analysis ~dce_config:p.dce_config ~cmtRoot:state.cmtRoot
381+
~reactive_collection:(Some p.reactive_collection)
382+
~reactive_merge:(Some p.reactive_merge)
383+
~reactive_liveness:(Some p.reactive_liveness)
384+
~reactive_solver:(Some p.reactive_solver) ~skip_file:None
366385
~file_stats ();
367386
issue_count := Log_.Stats.get_issue_count ();
368-
let d, l = ReactiveSolver.stats ~t:state.reactive_solver in
387+
let d, l = ReactiveSolver.stats ~t:p.reactive_solver in
369388
dead_count := d;
370389
live_count := l;
371-
Log_.Stats.report ~config:state.dce_config;
390+
Log_.Stats.report ~config:p.dce_config;
372391
Log_.Stats.clear ();
373392
EmitJson.finish ())
374393
|> response_of_result)

analysis/reanalyze/src/RunConfig.ml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ let runConfig =
2121
unsuppress = [];
2222
}
2323

24+
let reset () =
25+
runConfig.dce <- false;
26+
runConfig.exception_ <- false;
27+
runConfig.suppress <- [];
28+
runConfig.termination <- false;
29+
runConfig.transitive <- false;
30+
runConfig.unsuppress <- []
31+
2432
let all () =
2533
runConfig.dce <- true;
2634
runConfig.exception_ <- true;
@@ -31,3 +39,24 @@ let exception_ () = runConfig.exception_ <- true
3139
let termination () = runConfig.termination <- true
3240

3341
let transitive b = runConfig.transitive <- b
42+
43+
type snapshot = {
44+
dce: bool;
45+
exception_: bool;
46+
suppress: string list;
47+
termination: bool;
48+
transitive: bool;
49+
unsuppress: string list;
50+
}
51+
52+
let snapshot () =
53+
{
54+
dce = runConfig.dce;
55+
exception_ = runConfig.exception_;
56+
suppress = runConfig.suppress;
57+
termination = runConfig.termination;
58+
transitive = runConfig.transitive;
59+
unsuppress = runConfig.unsuppress;
60+
}
61+
62+
let equal_snapshot (a : snapshot) (b : snapshot) = a = b

compiler/common/bs_version.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
24-
let version = "13.0.0-alpha.2"
24+
let version = "13.0.0-alpha.3"
2525
let header = "// Generated by ReScript, PLEASE EDIT WITH CARE"

0 commit comments

Comments
 (0)