Skip to content

Commit 0a29fc8

Browse files
authored
super_errors_multi: multi-file fixture harness for cross-module errors (#8433)
* super_errors_multi: add multi-file fixture harness with 4 smoke fixtures * super_errors_multi: cover Includemod variants through compunit (.resi/.res signature mismatch) * super_errors_multi: cover cross-module type / record / constructor disambiguation errors * super_errors_multi: cover cross-module external, private constructor, unused open * super_errors_multi: drop orphan JSX expected snapshot * super_errors_multi: cover cross-module deprecation, open-shadows, label-constructor disambiguation * super_errors_multi: cover typemod Interface_not_compiled * super_errors_multi: cover cross-module exception, record extra field, polyvariant constraint, alias dot access * super_errors_multi: cover inline record constructor, variant spread, async/promise, optional label omitted * super_errors_multi: cover interface-hidden record access, uncurried arity, dict pattern, .resi-only ref * super_errors_multi: cover typecore Unqualified_gadt_pattern via cross-module GADT disambiguation * super_errors_multi: cover typecore Modules_not_allowed and Unexpected_existential * super_errors_multi: cover includecore Privacy, Field_mutable, Field_optional, Unboxed_representation, Tag_name mismatches * super_errors_multi: cover includecore Variant_representation via different @as tag types * Update changelog for #8433 * super_errors_multi: lowercase `.cmi` basenames in snapshot post-processing `find_in_path_uncap` resolves `.cmi` lookups case-insensitively, so the filename printed in error messages picks up whichever case the host filesystem returns: lowercase on macOS APFS/HFS+, capitalised on Linux ext4. Snapshots captured locally on macOS therefore mismatch on Linux CI (`foo.cmi` vs `Foo.cmi`). Normalise every `.cmi` basename to lowercase in postProcessErrorOutput so snapshots are platform-independent. The same function runs on the expected file too, so existing snapshots keep matching.
1 parent 4f27edd commit 0a29fc8

145 files changed

Lines changed: 1078 additions & 2 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
- Run `super_errors` fixtures in parallel (~2.4× faster locally). https://github.com/rescript-lang/rescript/pull/8430
5252
- Expand `super_errors` fixture coverage for the remaining reachable single-file error variants. https://github.com/rescript-lang/rescript/pull/8432
5353
- Cache OPAM env, rewatch build, and instrumented dune state in the coverage workflow. https://github.com/rescript-lang/rescript/pull/8434
54+
- Add a multi-file fixture harness (`super_errors_multi`) for cross-module errors and warnings. https://github.com/rescript-lang/rescript/pull/8433
5455

5556

5657
# 13.0.0-alpha.4

scripts/format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ echo Formatting OCaml code...
88
opam exec -- dune build @fmt --auto-promote
99

1010
echo Formatting ReScript code...
11-
files=$(find packages tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/build_tests/super_errors/fixtures/break_keyword_binding.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
11+
files=$(find packages tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/build_tests/super_errors/fixtures/break_keyword_binding.res" ! -path "tests/build_tests/super_errors_multi/fixtures/Iface_not_compiled/*" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
1212
./cli/rescript.js format $files
1313

1414
echo Formatting JS code...

scripts/format_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ case "$(uname -s)" in
1717
fi
1818

1919
echo "Checking ReScript code formatting..."
20-
files=$(find packages tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/build_tests/super_errors/fixtures/break_keyword_binding.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
20+
files=$(find packages tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/build_tests/super_errors/fixtures/break_keyword_binding.res" ! -path "tests/build_tests/super_errors_multi/fixtures/Iface_not_compiled/*" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*")
2121
if ./cli/rescript.js format --check $files; then
2222
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
2323
else
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fixtures/**/*.cmi
2+
fixtures/**/*.cmj
3+
fixtures/**/*.cmt
4+
fixtures/**/*.cmti
5+
fixtures/**/*.mjs
6+
fixtures/**/*.js
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
===== User.res =====
2+
3+
We've found a bug for you!
4+
/.../fixtures/Cross_abstract_type_construction/User.res:1:18
5+
6+
1 │ let bad: Abs.t = 1
7+
2 │
8+
9+
This has type: int
10+
But it's expected to have type: Abs.t
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
===== User.res =====
2+
3+
We've found a bug for you!
4+
/.../fixtures/Cross_async_promise_mismatch/User.res:1:29-44
5+
6+
1 │ let consume = (): string => Lib.fetch("api")
7+
2 │
8+
9+
This has type: promise<string>
10+
But it's expected to have type: string
11+
12+
- Did you mean to await this promise before using it?
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
===== C.res =====
2+
3+
We've found a bug for you!
4+
/.../fixtures/Cross_chain_of_aliases/C.res:1:23-29
5+
6+
1 │ let v: B.Reexport.t = "wrong"
7+
2 │
8+
9+
This has type: string
10+
But it's expected to have type: B.Reexport.t (defined as int)
11+
12+
You can convert string to int with Int.fromString.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
===== User.res =====
2+
3+
We've found a bug for you!
4+
/.../fixtures/Cross_dependent_clash/User.res:1:21-34
5+
6+
1 │ let _ = Sender.send({to_: "alice"})
7+
2 │
8+
9+
Some required record fields are missing: body.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
===== User.res =====
2+
3+
Warning number 3
4+
/.../fixtures/Cross_deprecated_type/User.res:1:8-15
5+
6+
1 │ let v: Legacy.t = 1
7+
2 │
8+
9+
deprecated: Legacy.t
10+
Use newType instead
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
===== User.res =====
2+
3+
Warning number 3
4+
/.../fixtures/Cross_deprecated_value/User.res:1:9-22
5+
6+
1 │ let x = Legacy.compute(1)
7+
2 │
8+
9+
deprecated: Legacy.compute
10+
Use computeNew instead

0 commit comments

Comments
 (0)