Skip to content

Commit 8e4d23f

Browse files
authored
Merge pull request #6699 from cknitt/11-to-master
Merge changes from 11.0_release into master
2 parents c7b3dce + 024f87a commit 8e4d23f

File tree

111 files changed

+1258
-131
lines changed

Some content is hidden

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

111 files changed

+1258
-131
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727

2828
- Make the `--help` arg be prioritized in the CLI, so correctly prints help message and skip other commands. https://github.com/rescript-lang/rescript-compiler/pull/6667
2929

30+
# 11.1.0-rc.6
31+
32+
#### :rocket: New Feature
33+
34+
- Add experimental BigInt support. https://github.com/rescript-lang/rescript-compiler/pull/6670, https://github.com/rescript-lang/rescript-compiler/pull/6696
35+
36+
#### :bug: Bug Fix
37+
38+
- Fix mishandling of uncurried functions in super errors. https://github.com/rescript-lang/rescript-compiler/pull/6694
39+
3040
# 11.1.0-rc.5
3141

3242
#### :bug: Bug Fix

jscomp/bsc/rescript_compiler_main.ml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,48 @@ let process_file sourcefile ?(kind ) ppf =
106106
in
107107
Config.uncurried := uncurried;
108108
res
109+
110+
let reprint_source_file sourcefile =
111+
let uncurried = !Config.uncurried in
112+
let kind = Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe sourcefile) in
113+
let sourcefile = set_abs_input_name sourcefile in
114+
let res = match kind with
115+
| Res ->
116+
let parseResult =
117+
Res_driver.parsingEngine.parseImplementation ~forPrinter:true ~filename:sourcefile
118+
in
119+
if parseResult.invalid then (
120+
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
121+
exit 1
122+
);
123+
Res_compmisc.init_path ();
124+
parseResult.parsetree
125+
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Ml
126+
|> Ppx_entry.rewrite_implementation
127+
|> Res_printer.printImplementation ~width:100 ~comments:parseResult.comments
128+
|> print_endline
129+
| Resi ->
130+
let parseResult =
131+
Res_driver.parsingEngine.parseInterface ~forPrinter:true ~filename:sourcefile
132+
in
133+
if parseResult.invalid then (
134+
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
135+
exit 1
136+
);
137+
Res_compmisc.init_path ();
138+
parseResult.parsetree
139+
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Mli
140+
|> Ppx_entry.rewrite_signature
141+
|> Res_printer.printInterface ~width:100 ~comments:parseResult.comments
142+
|> print_endline
143+
| _
144+
->
145+
print_endline ("Invalid input for reprinting ReScript source. Must be a ReScript file: " ^ sourcefile);
146+
exit 2
147+
in
148+
Config.uncurried := uncurried;
149+
res
150+
109151
let usage = "Usage: bsc <options> <files>\nOptions are:"
110152

111153
let ppf = Format.err_formatter
@@ -390,6 +432,9 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
390432
"-dsource", set Clflags.dump_source,
391433
"*internal* print source";
392434

435+
"-reprint-source", string_call reprint_source_file,
436+
"*internal* transform the target ReScript file using PPXes provided, and print the transformed ReScript code to stdout";
437+
393438
"-format", string_call format_file,
394439
"*internal* Format as Res syntax";
395440

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/UncurriedArgsNotApplied.res:3:15-21
4+
5+
1 │ let apply = (fn: (. unit) => option<int>) => fn(. ())
6+
2 │
7+
3 │ let _ = apply(Some(1))
8+
4 │
9+
10+
This value might need to be wrapped in a function that takes an extra
11+
parameter of type unit
12+
13+
Here's the original error message
14+
This has type: option<'a>
15+
But it's expected to have type: (. unit) => option<int>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
Warning number 11
3+
/.../fixtures/bigint_match_literal.res:3:3-4
4+
5+
1 │ let m1 = switch 1n {
6+
2 │ | 0001n => 1
7+
3 │ | 1n => 1
8+
4 │ | -0001n => -1
9+
5 │ | _ => 0
10+
11+
this match case is unused.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_bigint.res:5:10-20
4+
5+
3 │ let x = One(true)
6+
4 │
7+
5 │ let y = (x :> bigint)
8+
6 │
9+
10+
Type x is not a subtype of bigint
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_bigint_as.res:5:10-20
4+
5+
3 │ let x = One
6+
4 │
7+
5 │ let y = (x :> bigint)
8+
6 │
9+
10+
Type x is not a subtype of bigint

jscomp/build_tests/super_errors/expected/warnings4.res.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
14 │
1111

1212
You forgot to handle a possible case here, for example:
13-
| #second(_) | #fourth | #third
13+
| #second(_) | #fourth | #third

jscomp/build_tests/super_errors/expected/warnings5.res.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@ Either bind these labels explicitly or add ', _' to the pattern.
187187
60 │
188188

189189
You forgot to handle a possible case here, for example:
190-
| (_, true)
190+
| (_, true)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let apply = (fn: (. unit) => option<int>) => fn(. ())
2+
3+
let _ = apply(Some(1))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let m1 = switch 1n {
2+
| 0001n => 1
3+
| 1n => 1
4+
| -0001n => -1
5+
| _ => 0
6+
}

0 commit comments

Comments
 (0)