Repository navigation
Word signature mismatch errors in ReScript terms - #9078
Conversation
Changelog💅 Polish
Semantic Diff2 commits · Full page ✏️ Indent multi-line types and signatures in error messagescbcd4f6 · Christoph Knittel + Claude · Oct 27, 2026, 19:53 UTC · edited The outcome printer rendered a type, signature or module type to a string and handed it to Format as one piece, so every line after the first started at column 0 instead of under its heading, and a short multi-line signature could share a line with the text around it. Each line break is now a newline of the enclosing Format box, and a multi-line piece makes that box break around it. Diagnostic modified (module mismatch) module type S = {
type t
}
module M: {
module F: (X: S) => S with type t = X.t
} = {
module F = (X: S) => {
type t = int
}
}
} is not included in
…
Modules do not match: {
type t = int} is not included in { type t = X.t}
Part of #9074. Review
Word signature mismatch errors in ReScript terms1db203e · cknitt + Claude · Oct 27, 2026, 12:41 UTC
Diagnostic modified (variant constructor mismatch) module M: {
type rec t<_> = Int(int): t<int> | Str(string): t<string>
} = {
type rec t<_> = Int(int): t<int> | Str(string): t<int>
}
-The types for field Str are not equal.
+The types for constructor Str are not equal.Diagnostic modified (functor position) module type S = {
type t
}
module M: {
module F: (X: S) => S with type t = X.t
} = {
module F = (X: S) => {
type t = int
}
}
-At position module F(X) : <here>
+At position module F: (X) => <here>Diagnostic modified (missing value)
-The value `b' is required but not provided
+The value `b` is required but not providedDiagnostic modified (extension constructor)
-type t += Boom(string)
+type t += Boom(string)Review
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix-error-type-indentation #9078 +/- ##
==============================================================
+ Coverage 81.43% 81.45% +0.01%
==============================================================
Files 460 460
Lines 64634 64639 +5
==============================================================
+ Hits 52633 52649 +16
+ Misses 12001 11990 -11
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9078 |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Why:
Inclusion errors still used OCaml wording: variant constructors were
called fields, functor positions were written as `module F(X) : ...`,
names were quoted as `x', and extension constructors were printed
with two spaces after `+=`.
Diagnostic modified (variant constructor mismatch):
Example:
module M: {
type rec t<_> = Int(int): t<int> | Str(string): t<string>
} = {
type rec t<_> = Int(int): t<int> | Str(string): t<int>
}
Before (diagnostic):
The types for field Str are not equal.
After (diagnostic):
The types for constructor Str are not equal.
Diagnostic modified (functor position):
Example:
module type S = {
type t
}
module M: {
module F: (X: S) => S with type t = X.t
} = {
module F = (X: S) => {
type t = int
}
}
Before (diagnostic):
At position module F(X) : <here>
After (diagnostic):
At position module F: (X) => <here>
Diagnostic modified (missing value):
Before (diagnostic):
The value `b' is required but not provided
After (diagnostic):
The value `b` is required but not provided
Diagnostic modified (extension constructor):
Before (diagnostic):
type t += Boom(string)
After (diagnostic):
type t += Boom(string)
Review: Do record fields keep their wording?
Yes. Only the comparison of variant constructors uses the new
constructor errors; inline record fields of a constructor are still
compared as fields.
Fixes: #9066
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3
Signed-off-by: Christoph Knittel <ck@cca.io>
d7661d5 to
1db203e
Compare
cristianoc
left a comment
There was a problem hiding this comment.
Reviewed the wording-only delta on top of #9091, including constructor versus record-field errors, functor context rendering, and the new GADT/functor mismatch fixtures. No blocking issues found. CI checks inspected; tests were not rerun locally.
Fixes #9066. Stacked on #9091.
Signature mismatch errors now:
At position module F: (X) => <here>instead ofmodule F(X) : <here>);The value `b` is required);type t += Awith one space.New fixtures:
gadt_constructor_signature_mismatch,functor_signature_mismatch.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3