Skip to content

Commit 129b346

Browse files
committed
Merge branch 'master' into tests-changes-not-updated
2 parents 932df08 + 70a73ed commit 129b346

File tree

98 files changed

+1530
-1242
lines changed

Some content is hidden

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

98 files changed

+1530
-1242
lines changed

.devcontainer/postCreate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Install dev dependencies from OPAM
44
opam init -y --bare --disable-sandboxing
5-
opam switch create 5.2.1 --packages ocaml-option-static
5+
opam switch create 5.3.0 --packages ocaml-option-static
66
opam install . --deps-only -y
77

88
# For IDE support, install the OCaml language server

.github/workflows/ci.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,34 @@ jobs:
8787
matrix:
8888
include:
8989
- os: ubuntu-24.04 # x64
90-
ocaml_compiler: ocaml-variants.5.2.1+options,ocaml-option-static
90+
ocaml_compiler: ocaml-variants.5.3.0+options,ocaml-option-static
9191
upload_binaries: true
9292
upload_libs: true
9393
- os: ubuntu-24.04-arm # ARM
94-
ocaml_compiler: ocaml-variants.5.2.1+options,ocaml-option-static
94+
ocaml_compiler: ocaml-variants.5.3.0+options,ocaml-option-static
9595
upload_binaries: true
9696
# Build the playground compiler and run the benchmarks on the fastest runner
9797
build_playground: true
9898
benchmarks: true
9999
- os: macos-13 # x64
100-
ocaml_compiler: 5.2.1
100+
ocaml_compiler: 5.3.0
101101
upload_binaries: true
102102
- os: macos-14 # ARM
103-
ocaml_compiler: 5.2.1
103+
ocaml_compiler: 5.3.0
104104
upload_binaries: true
105105
- os: windows-latest
106-
ocaml_compiler: 5.2.1
106+
ocaml_compiler: 5.3.0
107107
upload_binaries: true
108108

109109
# Verify that the compiler still builds with older OCaml versions
110+
- os: ubuntu-24.04
111+
ocaml_compiler: ocaml-variants.5.2.1+options,ocaml-option-static
112+
# Reanalyze does not work on OCaml 5.3.0 anymore, therefore run it on 5.2.1
113+
run_reanalyze: true
110114
- os: ubuntu-24.04
111115
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
112116
- os: ubuntu-24.04
113117
ocaml_compiler: ocaml-variants.4.14.2+options,ocaml-option-static
114-
- os: ubuntu-24.04
115-
ocaml_compiler: ocaml-variants.4.13.0+options,ocaml-option-static
116118

117119
runs-on: ${{matrix.os}}
118120

@@ -299,6 +301,12 @@ jobs:
299301
if: ${{ runner.os == 'Windows' }}
300302
run: opam exec -- make test-syntax
301303

304+
- name: "Syntax: Run reanalyze"
305+
if: matrix.run_reanalyze
306+
run: |
307+
opam install reanalyze
308+
opam exec -- make reanalyze
309+
302310
- name: Build runtime/stdlib
303311
run: ./scripts/buildRuntime.sh
304312
shell: bash

.ocamlformat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
profile = default
2-
version = 0.26.2
2+
version = 0.27.0
33

44
field-space = tight-decl
55
break-cases = toplevel
@@ -9,3 +9,4 @@ space-around-arrays = false
99
space-around-lists = false
1010
space-around-records = false
1111
space-around-variants = false
12+
parse-docstrings = false

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#### :nail_care: Polish
1616

1717
- Allow single newline in JSX. https://github.com/rescript-lang/rescript/pull/7269
18+
- Editor: Always complete from Core first. Use actual native regex syntax in code snippets for regexps. https://github.com/rescript-lang/rescript/pull/7295
1819

1920
#### :bug: Bug fix
2021

@@ -29,6 +30,8 @@
2930
#### :house: Internal
3031

3132
- Remove ignore in res_scanner.ml . https://github.com/rescript-lang/rescript/pull/7280
33+
- Use the new stdlib modules in the analysis tests. https://github.com/rescript-lang/rescript/pull/7295
34+
- Build with OCaml 5.3.0. https://github.com/rescript-lang/rescript-compiler/pull/7294
3235

3336
# 12.0.0-alpha.8
3437

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Make sure you have [opam](https://opam.ocaml.org/doc/Install.html) installed on
4747
opam init
4848

4949
# Any recent OCaml version works as a development compiler
50-
opam switch create 5.2.1 # can also create local switch with opam switch create
50+
opam switch create 5.3.0 # can also create local switch with opam switch create
5151

5252
# Install dev dependencies from OPAM
5353
opam install . --deps-only --with-test --with-dev-setup -y

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ test-tools:
4040

4141
test-syntax:
4242
bash ./scripts/test_syntax.sh
43-
make reanalyze
4443
bash ./scripts/testok.sh
4544

4645
test-syntax-roundtrip:
4746
ROUNDTRIP_TEST=1 bash ./scripts/test_syntax.sh
48-
make reanalyze
4947
bash ./scripts/testok.sh
5048

5149
test-gentype:

analysis.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ license: "LGPL-3.0-or-later"
77
homepage: "https://github.com/rescript-lang/rescript-compiler"
88
bug-reports: "https://github.com/rescript-lang/rescript-compiler/issues"
99
depends: [
10-
"ocaml" {>= "4.10"}
11-
"cppo" {= "1.6.9"}
10+
"ocaml" {>= "4.14"}
11+
"cppo" {= "1.8.0"}
1212
"dune"
1313
]
1414
build: [

analysis/reanalyze/src/DeadCommon.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ module Decl = struct
555555
let refIsBelow (pos : Lexing.position) =
556556
decl.pos.pos_fname <> pos.pos_fname
557557
|| decl.pos.pos_cnum < pos.pos_cnum
558-
&& (* not a function defined inside a function, e.g. not a callback *)
558+
&&
559+
(* not a function defined inside a function, e.g. not a callback *)
559560
decl.posEnd.pos_cnum < pos.pos_cnum
560561
in
561562
refs |> PosSet.exists refIsBelow

analysis/src/CompletionBackEnd.ml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10901090
*)
10911091
let completeAsBuiltin =
10921092
match typePath with
1093-
| Some t ->
1094-
TypeUtils.completionPathFromMaybeBuiltin t ~package:full.package
1093+
| Some t -> TypeUtils.completionPathFromMaybeBuiltin t
10951094
| None -> None
10961095
in
10971096
let completionPath =
@@ -1452,9 +1451,10 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens
14521451
(* Special casing for things where we want extra things in the completions *)
14531452
let completionItems =
14541453
match path with
1455-
| Pdot (Pdot (Pident m, "Re", _), "t", _) when Ident.name m = "Js" ->
1454+
| Pdot (Pdot (Pident {name = "Js"}, "Re", _), "t", _)
1455+
| Pdot (Pident {name = "RegExp"}, "t", _) ->
14561456
(* regexps *)
1457-
create "%re()" ~insertText:"%re(\"/$0/g\")" ~includesSnippets:true
1457+
create "/<regexp>/g" ~insertText:"/$0/g" ~includesSnippets:true
14581458
~kind:(Label "Regular expression") ~env
14591459
:: completionItems
14601460
| _ -> completionItems
@@ -1801,8 +1801,7 @@ let rec completeTypedValue ?(typeArgContext : typeArgContext option) ~rawOpens
18011801
if Debug.verbose () then print_endline "[complete_typed_value]--> Texn";
18021802
[
18031803
create
1804-
(full.package.builtInCompletionModules.exnModulePath @ ["Error(error)"]
1805-
|> ident)
1804+
(["Exn"; "Error(error)"] |> ident)
18061805
~kind:(Label "Catches errors from JavaScript errors.")
18071806
~docstring:
18081807
[
@@ -2244,12 +2243,7 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
22442243
| _ -> items)))
22452244
| CexhaustiveSwitch {contextPath; exprLoc} ->
22462245
let range = Utils.rangeOfLoc exprLoc in
2247-
let rescriptMajor, rescriptMinor = Packages.getReScriptVersion () in
2248-
let printFailwithStr num =
2249-
if (rescriptMajor = 11 && rescriptMinor >= 1) || rescriptMajor >= 12 then
2250-
"${" ^ string_of_int num ^ ":%todo}"
2251-
else "${" ^ string_of_int num ^ ":failwith(\"todo\")}"
2252-
in
2246+
let printFailwithStr num = "${" ^ string_of_int num ^ ":%todo}" in
22532247
let withExhaustiveItem ~cases ?(startIndex = 0) (c : Completion.t) =
22542248
(* We don't need to write out `switch` here since we know that's what the
22552249
user has already written. Just complete for the rest. *)

analysis/src/Packages.ml

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -148,61 +148,6 @@ let newBsPackage ~rootPath =
148148
pathsForModule;
149149
opens;
150150
namespace;
151-
builtInCompletionModules =
152-
(if
153-
opens_from_bsc_flags
154-
|> List.find_opt (fun opn ->
155-
match opn with
156-
| ["RescriptCore"] -> true
157-
| _ -> false)
158-
|> Option.is_some
159-
|| fst rescriptVersion >= 12
160-
then
161-
{
162-
arrayModulePath = ["Array"];
163-
optionModulePath = ["Option"];
164-
stringModulePath = ["String"];
165-
intModulePath = ["Int"];
166-
floatModulePath = ["Float"];
167-
promiseModulePath = ["Promise"];
168-
listModulePath = ["List"];
169-
resultModulePath = ["Result"];
170-
exnModulePath = ["Exn"];
171-
regexpModulePath = ["RegExp"];
172-
}
173-
else if
174-
opens_from_bsc_flags
175-
|> List.find_opt (fun opn ->
176-
match opn with
177-
| ["Belt"] -> true
178-
| _ -> false)
179-
|> Option.is_some
180-
then
181-
{
182-
arrayModulePath = ["Array"];
183-
optionModulePath = ["Option"];
184-
stringModulePath = ["Js"; "String2"];
185-
intModulePath = ["Int"];
186-
floatModulePath = ["Float"];
187-
promiseModulePath = ["Js"; "Promise"];
188-
listModulePath = ["List"];
189-
resultModulePath = ["Result"];
190-
exnModulePath = ["Js"; "Exn"];
191-
regexpModulePath = ["Js"; "Re"];
192-
}
193-
else
194-
{
195-
arrayModulePath = ["Js"; "Array2"];
196-
optionModulePath = ["Belt"; "Option"];
197-
stringModulePath = ["Js"; "String2"];
198-
intModulePath = ["Belt"; "Int"];
199-
floatModulePath = ["Belt"; "Float"];
200-
promiseModulePath = ["Js"; "Promise"];
201-
listModulePath = ["Belt"; "List"];
202-
resultModulePath = ["Belt"; "Result"];
203-
exnModulePath = ["Js"; "Exn"];
204-
regexpModulePath = ["Js"; "Re"];
205-
});
206151
uncurried;
207152
}))
208153
| None -> None

0 commit comments

Comments
 (0)