Skip to content

Print private in type declarations of error messages - #8999

Merged
cknitt merged 1 commit into
masterfrom
private-abbrev-in-errors
Oct 23, 2026
Merged

cknitt merged 1 commit into
masterfrom
private-abbrev-in-errors

Conversation

@cknitt

@cknitt cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member

Fixes #8996.

The outcome printer, which prints type declarations in error messages, dropped private from abbreviations, variants and manifests; only records and open types kept it. So a privacy mismatch printed a declaration as included in itself, and a mismatch against type t = private a showed a public alias:

Declaration Before After
type t = private int (existing fixture Iface_privacy_mismatch) type t = int is not included in type t = int type t = private int is not included in type t = int
type t = private a type t = a type t = private a
type v = private A | B type v = A | B type v = private A | B
type w = v = private A | B type w = v = A | B type w = v = private A | B
type t = private {.."x": int} (existing fixture object_private_row_grants_set) type t = {.."x": int} type t = private {.."x": int}

private now goes after the = of an abbreviation or variant, and after the manifest of a re-exported variant.

New tests: super_errors_multi/Cross_private_abbreviation_mismatch and Cross_private_variant_manifest_mismatch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t

Why:
    The outcome printer dropped `private` from abbreviations, variants and
    manifests, so a privacy mismatch read "type t = int is not included in
    type t = int", and a mismatch against `type t = private a` showed a
    public alias (#8996).

`private` is printed after the `=` of an abbreviation or a variant, and
after the manifest of a re-exported variant, as records and open types
already did.

Diagnostic modified (privacy mismatch):
Example:
    // Foo.resi
    type t = int
    // Foo.res
    type t = private int
Before (diagnostic):
    Type declarations do not match:
      type t = int
    is not included in
      type t = int
After (diagnostic):
    Type declarations do not match:
      type t = private int
    is not included in
      type t = int

Diagnostic modified (a re-exported private variant):
Example:
    // Priv.resi
    type v = A | B
    type w = v = private A | B
    // Priv.res
    type v = A | B
    type w = A | B
Before (diagnostic):
    is not included in
      type w = v = A | B
After (diagnostic):
    is not included in
      type w = v = private A | B

Fixes: #8996
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t
Signed-off-by: Christoph Knittel <ck@cca.io>
@github-actions

Copy link
Copy Markdown

Semantic Diff

1 commit · Full page

Print private in type declarations of error messages

2a21564 · Christoph Knittel with Claude Opus 5.5 · Oct 23, 2026

Why

The outcome printer dropped private from abbreviations, variants and manifests, so a privacy mismatch read "type t = int is not included in type t = int", and a mismatch against type t = private a showed a public alias (#8996).

private is printed after the = of an abbreviation or a variant, and after the manifest of a re-exported variant, as records and open types already did.

Diagnostic modified (privacy mismatch)

// Foo.resi
type t = int
// Foo.res
type t = private int

diagnostic

 Type declarations do not match:
-  type t = int
+  type t = private int
 is not included in
   type t = int

Diagnostic modified (a re-exported private variant)

// Priv.resi
type v = A | B
type w = v = private A | B
// Priv.res
type v = A | B
type w = A | B

diagnostic

 is not included in
-  type w = v = A | B
+  type w = v = private A | B

@cknitt
cknitt marked this pull request as ready for review October 23, 2026 15:28
@cknitt

cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

@cknitt
cknitt requested a review from cristianoc October 23, 2026 15:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T15:30:38.119597Z 2a21564 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 2a2156422e

ℹ️ 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".

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.27%. Comparing base (c9a267c) to head (2a21564).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8999   +/-   ##
=======================================
  Coverage   81.27%   81.27%           
=======================================
  Files         456      456           
  Lines       63828    63834    +6     
=======================================
+ Hits        51875    51882    +7     
+ Misses      11953    11952    -1     
Files with missing lines Coverage Δ
compiler/syntax/src/res_outcome_printer.ml 81.63% <100.00%> (-0.21%) ⬇️

... and 2 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.

@cknitt
cknitt enabled auto-merge (squash) October 23, 2026 15:32
@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8999

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 2a21564

@github-actions

Copy link
Copy Markdown

@cknitt
cknitt merged commit f371c72 into master Oct 23, 2026
26 checks passed
@cknitt
cknitt deleted the private-abbrev-in-errors branch October 23, 2026 15:55
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.

Type mismatch errors print a private abbreviation without private

2 participants