Repository navigation
Conversation
Changelog🐛 Bug fix
Semantic Diff1 commit · Full page Show a functor's parameters on hoveraac2e68 · cknitt + Claude · Oct 27, 2026, 12:54 UTC
Diagnostic modified (hover on a functor) module type Ord = {
type t
let compare: (t, t) => int
}
module MakeSet = (O: Ord) => {
type t = array<O.t>
let add = (s: t, x: O.t) => s->Array.concat([x])
}
-module MakeSet: {
+module MakeSet: (O: Ord) => {
type t = array<O.t>
let add: (t, O.t) => array<O.t>
}Review
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix-9072-applied-functor-types #9083 +/- ##
===============================================================
Coverage 81.46% 81.47%
===============================================================
Files 460 460
Lines 64688 64711 +23
===============================================================
+ Hits 52700 52721 +21
- Misses 11988 11990 +2
🚀 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-9083 |
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71fcc36a3f
ℹ️ 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".
71fcc36 to
518b1df
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
cristianoc
left a comment
There was a problem hiding this comment.
Reviewed the hover parameter metadata, applied-signature dependency, and named/multiple/inline/applied/partial/generative fixtures. The reported structural-result case is fixed, and no blocking regression was found. Named-result Ident functors remain a pre-existing limitation. CI analysis tests inspected; tests were not rerun locally.
Why:
Editor analysis models a functor by the structure of its result, so
hover on a functor showed its body as if it were a plain module, and
nothing said it takes arguments. The result structure now records the
parameters, and hover prints them in front of the body.
Diagnostic modified (hover on a functor):
Example:
module type Ord = {
type t
let compare: (t, t) => int
}
module MakeSet = (O: Ord) => {
type t = array<O.t>
let add = (s: t, x: O.t) => s->Array.concat([x])
}
Before (rescript): tests/analysis_tests/tests/src/HoverFunctor.res
module MakeSet: {
type t = array<O.t>
let add: (t, O.t) => array<O.t>
}
After (rescript): tests/analysis_tests/tests/src/HoverFunctor.res
module MakeSet: (O: Ord) => {
type t = array<O.t>
let add: (t, O.t) => array<O.t>
}
Review: Why not add a functor case to the analysis module type?
Completion, references and path resolution all treat a functor as its
result and would each need the new case; only hover displays the
parameters, so they are recorded on the result structure.
Review: What does hover show for an applied functor?
A plain module: an application is modelled by its signature, so
`module IntSet = MakeSet(IntOrd)` shows no parameters, and a partial
application such as `Pair(IntOrd)` shows only the remaining one.
Fixes: #9071
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>
518b1df to
aac2e68
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aac2e68c57
ℹ️ 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".
| | Structure s -> Structure {s with functor_params = param :: s.functor_params} | ||
| | Constraint (m1, m2) -> | ||
| Constraint (add_functor_param param m1, add_functor_param param m2) | ||
| | Ident _ -> m |
There was a problem hiding this comment.
Preserve functor parameters on identifier results
For a functor with a named result signature, such as module Make = (O: Ord): Set => {...} or an interface declaration module Make: (O: Ord) => Set, the result becomes Ident Set, and this branch discards the parameter. Hover.show_module subsequently resolves that identifier to Set, so hover still describes Make as a plain module without (O: Ord) =>. The same loss occurs for functors whose body returns a module identifier. Preserve the parameters independently of the result's representation and carry them through identifier resolution.
Useful? React with 👍 / 👎.
Fixes #9071. Stacked on #9084, which models an applied functor by its result signature.
Hover on a functor now shows its parameters, for example
module MakeSet: (O: Ord) => {...}. Analysis models a functor by its result structure; the parameters are recorded on that structure, and only hover displays them.An applied functor such as
module IntSet = MakeSet(IntOrd)is a plain module and shows no parameters; a partial application shows only the remaining ones, and a generative functor shows() =>.New analysis test:
HoverFunctor(named, multi-parameter, inline-signature, applied, partially applied and generative functors).🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3