Skip to content

Commit 63fd342

Browse files
authored
Clean up Super_error (#6199)
* add tests * error message with loc of repeated definition * changelog * clean up * clean up super_error * use Location.print_loc * move some tests from ounit to super_errors * changelog * remove unused ounit tests * changelog * changelog
1 parent f2d5c80 commit 63fd342

38 files changed

+618
-944
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#### :boom: Breaking Change
2525

2626
- Parse `assert` as a regular function. `assert` is no longer a unary expression. Example: before `assert 1 == 2` is parsed as `(assert 1) == 2`, now it is parsed as `assert(1 == 2)`. https://github.com/rescript-lang/rescript-compiler/pull/6180
27+
- `-bs-super-errors` flag has been removed along with Super_errors. https://github.com/rescript-lang/rescript-compiler/pull/6199
2728

2829
#### :bug: Bug Fix
2930

@@ -32,6 +33,11 @@
3233
- Add error messages for dangling doc comments/attributes and mutable in record type definition. https://github.com/rescript-lang/rescript-compiler/pull/6206
3334
- Fix issue with overlapping array and object in untagged variants https://github.com/rescript-lang/rescript-compiler/pull/6219
3435

36+
#### :nail_care: Polish
37+
38+
- Add location information to duplicate type definition error messages. https://github.com/rescript-lang/rescript-compiler/pull/6199
39+
- Replace normal module errors with Super_error module, and clean up Super_error. https://github.com/rescript-lang/rescript-compiler/pull/6199
40+
3541
# 11.0.0-alpha.4
3642

3743
#### :rocket: Main New Feature

jscomp/bsc/dune

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
(public_name bsc)
99
(flags
1010
(:standard -w +a-4-9-30-40-41-42-48-70))
11-
(libraries common core depends gentype js_parser syntax super_errors
12-
outcome_printer))
11+
(libraries common core depends gentype js_parser syntax outcome_printer))

jscomp/bsc/rescript_compiler_main.ml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ let setup_compiler_printer (syntax_kind : [ syntax_kind | `default])=
2525
| `default -> ()
2626
| #syntax_kind as k -> Config.syntax_kind := k);
2727
let syntax_kind = !Config.syntax_kind in
28-
if syntax_kind = `rescript then begin
29-
Lazy.force Super_main.setup;
28+
if syntax_kind = `rescript then begin
3029
Lazy.force Res_outcome_printer.setup
3130
end
3231

@@ -206,7 +205,6 @@ let print_version_string () =
206205

207206
let [@inline] set s : Bsc_args.spec = Unit (Unit_set s)
208207
let [@inline] clear s : Bsc_args.spec = Unit (Unit_clear s)
209-
let [@inline] unit_lazy s : Bsc_args.spec = Unit(Unit_lazy s)
210208
let [@inline] string_call s : Bsc_args.spec =
211209
String (String_call s)
212210
let [@inline] string_optional_set s : Bsc_args.spec =
@@ -294,10 +292,6 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
294292

295293
(******************************************************************************)
296294

297-
298-
"-bs-super-errors", unit_lazy Super_main.setup,
299-
"*internal* Better error message combined with other tools ";
300-
301295
"-unboxed-types", set Clflags.unboxed_types,
302296
"*internal* Unannotated unboxable types will be unboxed";
303297

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/repeated_def_extension_constr.res:3:6
4+
5+
1 │ type a = ..
6+
2 │
7+
3 │ type a
8+
4 │
9+
10+
Multiple definition of the type name a
11+
at /.../fixtures/repeated_def_extension_constr.res:1:6
12+
Names must be unique in a given structure or signature.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/repeated_def_module_types.res:3:13
4+
5+
1 │ module type M = {}
6+
2 │
7+
3 │ module type M = {}
8+
4 │
9+
10+
Multiple definition of the module type name M
11+
at /.../fixtures/repeated_def_module_types.res:1:13
12+
Names must be unique in a given structure or signature.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/repeated_def_modules.res:3:8
4+
5+
1 │ module M = {}
6+
2 │
7+
3 │ module M = {}
8+
4 │
9+
10+
Multiple definition of the module name M
11+
at /.../fixtures/repeated_def_modules.res:1:8
12+
Names must be unique in a given structure or signature.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/repeated_def_types.res:3:6
4+
5+
1 │ type a
6+
2 │
7+
3 │ type a
8+
4 │
9+
10+
Multiple definition of the type name a
11+
at /.../fixtures/repeated_def_types.res:1:6
12+
Names must be unique in a given structure or signature.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/type2.res:6:11-13
4+
5+
4 │ let () = {
6+
5 │ push(a, 3)->ignore
7+
6 │ push(a, "3")->ignore
8+
7 │ }
9+
8 │
10+
11+
This has type: string
12+
Somewhere wanted: int
13+
14+
You can convert string to int with Belt.Int.fromString.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/type3.res:1:5
4+
5+
1 │ let u = []
6+
2 │
7+
8+
This expression's type contains type variables that cannot be generalized:
9+
array<'_weak1>
10+
11+
This happens when the type system senses there's a mutation/side-effect,
12+
in combination with a polymorphic value.
13+
Using or annotating that value usually solves it.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type a = ..
2+
3+
type a

0 commit comments

Comments
 (0)