Skip to content

super_errors: round two of error fixture coverage#8432

Open
JonoPrest wants to merge 34 commits into
rescript-lang:masterfrom
JonoPrest:jono/expand-coverage-2
Open

super_errors: round two of error fixture coverage#8432
JonoPrest wants to merge 34 commits into
rescript-lang:masterfrom
JonoPrest:jono/expand-coverage-2

Conversation

@JonoPrest
Copy link
Copy Markdown
Contributor

super_errors: round two of error fixture coverage

Builds on #8429 (jono/expand-coverage). Same playbook — one .res file per
error variant — applied to the variants that branch missed.

~75 new single-file fixtures across 33 commits, covering every reachable
single-file error variant in typecore, typedecl, typemod, typetexp,
includemod, translcore, translmod, transl_recmodule, rec_check, and
bs_syntaxerr.

After this round, what remains either requires multi-file setups (separate
follow-up) or is dead code in the current parser / compiler. Both lists are
written down below so reviewers don't have to re-derive them.

Coverage impact

Measured locally with make coverage (bisect_ppx point coverage). Baseline is
upstream/master after #8429 was merged.

Metric Baseline This branch Δ
Overall 50.94% (37190 / 73012) 52.11% (38049 / 73012) +1.17 pp / +859 points

Per-file moves on the modules this branch targets:

File Baseline This branch Δ pp
compiler/ml/transl_recmodule.ml 1.54% 35.38% +33.85
compiler/frontend/bs_syntaxerr.ml 45.95% 67.57% +21.62
compiler/ml/typemod.ml 41.00% 58.58% +17.58
compiler/ml/rec_check.ml 3.48% 20.00% +16.52
compiler/ml/typetexp.ml 60.32% 74.38% +14.06
compiler/ml/typedecl.ml 59.31% 68.62% +9.31
compiler/ml/includemod.ml 55.52% 63.17% +7.65
compiler/frontend/ast_attributes.ml 56.06% 62.88% +6.82
compiler/ml/translmod.ml 67.89% 71.56% +3.67
compiler/frontend/ast_external_process.ml 38.91% 41.64% +2.73
compiler/ml/typecore.ml 73.83% 75.53% +1.70
compiler/ml/translcore.ml 71.09% 71.45% +0.37

What's covered

typecore — Label_not_mutable, Apply_non_function, Invalid_for_loop_index,
Field_access_on_dict_type, Private_label, Not_an_extension_constructor,
Invalid_extension_constructor_payload, Inlined_record_expected, Less_general,
Constructor_arity_mismatch (expression + pattern), Private_type construction,
let-module scope escape, Cannot_infer_signature, Undefined_method.

typedecl — Boxed_and_unboxed, Bad_unboxed_attribute (abstract, mutable,
many-fields, extensible), Constraint_failed, Nonrec_gadt, Not_extensible_type,
Cannot_extend_private_type, Object_spread_with_record_field,
Inconsistent_constraint, Bad_immediate_attribute, Unbound_type_var_ext,
Bad_variance (covariant + contravariant), Definition_mismatch,
Invalid_attribute (@notundefined on non-abstract), Variant_spread_fail
(non-variant source).

typemod — With_no_component, Cannot_apply,
Recursive_module_require_explicit_type, Apply_generative, With_mismatch,
Structure_expected (opening a functor), Not_a_packed_module,
Not_allowed_in_functor_body, Incomplete_packed_module, Non_generalizable.

typetexp — Unbound_value, Unbound_constructor, Unbound_label,
Unbound_modtype, Multiple_constraints_on_type, Method_mismatch,
Access_functor_as_structure, Constructor_mismatch, Not_an_object,
Opened_object, Alias_type_mismatch.

includemod — Missing_field, Value_descriptions, Type_declarations,
Module_types, Extension_constructors, Modtype_infos, Modtype_permutation.

bs_syntaxerr — Invalid_bs_int_type, Invalid_bs_string_type,
Invalid_bs_unwrap_type, Conflict_attributes, Expect_string_literal,
Expect_int_literal, Not_supported_directive_in_bs_return,
Expect_opt_in_bs_return_to_opt, Illegal_attribute.

translcore — Unknown_builtin_primitive.

translmod — Fragile_pattern_in_toplevel.

transl_recmodule — Circular_dependency.

rec_check — Illegal_letrec_expr.

Dead in modern ReScript (parser / compiler can't produce the AST shape)

  • Invalid_for_of_pattern — parser pre-normalizes the pattern.
  • Polymorphic_label (typecore) — record set / match paths now succeed.
  • Parameters_differ — variant declarations with non-uniform recursion are
    accepted; abbreviations hit Cycle_in_def first.
  • Apply_structure_as_functor, Ill_typed_functor_application,
    Cannot_eliminate_dependencyM(N).t type-level syntax doesn't exist,
    and module-level functor applications always resolve concretely.
  • Misplaced_label_syntax — only fires for labeled args to ->/#=/##,
    but the parser always emits those as Nolabel.
  • Variant_tags — the Tags exception is defined in ctype.ml but never
    raised; the path is effectively dead.
  • Unhandled_poly_type — parser rejects inline poly types in arrow chains.
  • Unqualified_gadt_pattern — masked by Unbound_constructor in every
    natural reproduction.
  • Name_type_mismatch — every reproduction lands on Wrong_name first.
  • Val_in_structure — requires pval_prim = [], which the parser never
    produces.
  • Bad_fixed_type, Unbound_type_constructor_2 — behind #row private-row
    syntax that isn't exposed.
  • Invalid_underscore_type_in_external — needs ?label:_ in @@obj
    externals; the standalone form is fine.
  • Cannot_quantify (typetexp) — every value-level reproduction lands on
    Less_general first; type-level Ptyp_poly always quantifies cleanly.
  • Recursive_local_constraint — GADT pattern that would produce
    a cyclic local abbreviation doesn't surface this error in ReScript's
    matcher.
  • Bs_this_simple_pattern, Optional_in_uncurried_bs_attribute,
    Conflict_bs_bs_this_bs_meth@this doesn't parse on regular functions.
  • Expect_int_or_string_or_json_literal — needs an @as(...) with a
    delimited string that isn't a valid JS literal; plain string / int /
    identifier payloads all succeed.
  • Unsupported_predicates@get / @set reject unknown payload shapes
    earlier with the generic "Invalid payload" message.
  • Illegal_reference_to_recursive_module — the Env.Recmodule exception
    isn't reachable from a single-file recmodule (the placeholder is sealed
    before the type lookup runs).
  • With_cannot_remove_constrained_type, With_changes_module_alias,
    With_makes_applicative_functor_ill_typed — niche with type paths that
    don't fire from any single-file with type X := ... construction I tried.
  • ast_utf8_string family (Invalid_hex_escape, Invalid_unicode_escape,
    Invalid_unicode_codepoint_escape, Invalid_code_point,
    Unterminated_backslash) — only reachable via the legacy {j|…|j}
    delimiter; backquote template strings skip the transform.

Reachable only with multi-file setups

These are real, user-facing errors but can't be triggered from one .res:

  • typetexp.Cannot_scrape_alias, typemod.Cannot_scrape_alias — need a
    broken alias chain that crosses module boundaries.
  • typedecl.Unavailable_type_constructor — needs a type path that
    disappears, which happens across compilation units.
  • typemod.Interface_not_compiled — missing .cmi, by definition
    multi-unit.
  • typemod.Scoping_pack, typemod.Non_generalizable_module — require
    module sealing where types from different scopes meet.
  • includemod.Interface_mismatch, includemod.Invalid_module_alias,
    includemod.Unbound_modtype_path, includemod.Unbound_module_path — all
    fire only across module / file boundaries.

These motivate the multi-file harness follow-up — same playbook (one fixture
per error variant) but compiling a directory tree per fixture instead of one
file.

Closing claim

This is now exhaustive for single-file super_errors fixtures. Every
remaining error variant in the modules above either has a fixture, has a
written-down reason it can't be triggered from one file, or is dead code.

JonoPrest added 30 commits May 19, 2026 17:37
…nvalid_for_loop_index, Field_access_on_dict_type, Private_label
…tension_constructor_payload, Inlined_record_expected
…, Expect_opt_in_bs_return_to_opt, Illegal_attribute
@JonoPrest JonoPrest marked this pull request as ready for review May 19, 2026 15:40
@JonoPrest
Copy link
Copy Markdown
Contributor Author

@codex review

@JonoPrest JonoPrest requested a review from cknitt May 19, 2026 15:43
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8432

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8432

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8432

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8432

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8432

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8432

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8432

commit: 655251a

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.92%. Comparing base (2f06e07) to head (655251a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8432      +/-   ##
==========================================
+ Coverage   59.10%   59.92%   +0.82%     
==========================================
  Files         373      373              
  Lines       54210    54210              
==========================================
+ Hits        32040    32487     +447     
+ Misses      22170    21723     -447     

see 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant