Repository navigation
Conversation
Changelog🐛 Bug fix
Semantic Diff1 commit · Full page ✏️ Treat included members as copies of their original declarations in editor analysis16f3ab8 · cknitt + Claude · Nov 19, 2026, 06:19 UTC · edited
References modified (include) // Lib.res
module type T = {
type t
}
module Make = (X: T) => {
type shape = Dot | Box(X.t)
}
// Main.res
include Lib.Make({
type t = int
})
let v0 = 0
let v1 = 1
let v2 = 2
module type T = {
type t
}
module F = (X: T) => {
let fv = 1
}
include F({
type t = int
})
let u = fv
// Other.res
let w = Main.v0 + Main.v1
-v0 in Main Main 3:4, Main 0:-1, Main 3:4
-fv in F Main 10:6
+v0 in Main Main 3:4, Other 0:13
+fv in F Main 10:6, Main 15:8
fv after include Main 10:6, Main 15:8References modified (constructor of an included type) // Main.res, with Lib.res as above
include Lib.Make({
type t = int
})
let v0 = 0
let v1 = 1
let dot = Dot
let box = Box(1)
-Dot in Main Main 3:4, Main 0:-1, Main 3:4, Main 5:10
-definition of Box null
+Dot in Main Main 5:10, Lib 4:15
+definition of Box Lib 4:21A copy whose original member is found is no longer a declaration of the including file: it gets no definition item and no declaration reference, and the constructors of an included type are not put in the stamp table. Find References on a value, type or module collects the original member and all its copies in the file. Constructors and record fields of an included type are looked up in the type they were copied from, which links them to their declaration in the other file. Review
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9331 +/- ##
==========================================
+ Coverage 82.12% 82.17% +0.05%
==========================================
Files 456 456
Lines 65661 65723 +62
==========================================
+ Hits 53926 54011 +85
+ Misses 11735 11712 -23
🚀 New features to boost your workflow:
|
✅ Compiler benchmarksAllocated wordsIn total: 639,846,772 → 639,846,625 (±0.00%). Generated projects: 629,813,365 → 629,811,987 (±0.00%). None of the 265 benchmarks changed by 0.1% or more. InstructionsIn total: 9,210,478,378 → 9,210,478,378 (±0.00%). None of the 33 benchmarks changed by 0.1% or more. Output sizeIn total: 25,919,386 → 25,919,386 (±0.00%). None of the 13 benchmarks changed by 0.1% or more. Pull request 16f3ab8 compared with base 91d74a0 in this run. |
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-9331 |
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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: 73f322a215
ℹ️ 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".
73f322a to
610362c
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 610362c9da
ℹ️ 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".
610362c to
5bc3c31
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bc3c3186f
ℹ️ 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".
…itor analysis
Why:
An `include` copies the members of a module under new stamps, at the
positions of the original declarations. Analysis registered each copy
as a declaration of the including file. An include does not rename
constructors, so the copied `Dot` and `Box` below keep their stamps
from Lib's compilation, which are the stamps of `v0` and `v1` in Main.
That hid `v0` and `v1`, listed bogus locations and lost their uses in
other files. The copy of `fv` was a second declaration at the position
of `let fv`, so references from the declaration and from the use split.
References modified (include):
Example:
// Lib.res
module type T = {
type t
}
module Make = (X: T) => {
type shape = Dot | Box(X.t)
}
// Main.res
include Lib.Make({
type t = int
})
let v0 = 0
let v1 = 1
let v2 = 2
module type T = {
type t
}
module F = (X: T) => {
let fv = 1
}
include F({
type t = int
})
let u = fv
// Other.res
let w = Main.v0 + Main.v1
Before (text): line:column, from 0
v0 in Main Main 3:4, Main 0:-1, Main 3:4
fv in F Main 10:6
fv after include Main 10:6, Main 15:8
After (text):
v0 in Main Main 3:4, Other 0:13
fv in F Main 10:6, Main 15:8
fv after include Main 10:6, Main 15:8
References modified (constructor of an included type):
Example:
// Main.res, with Lib.res as above
include Lib.Make({
type t = int
})
let v0 = 0
let v1 = 1
let dot = Dot
let box = Box(1)
Before (text): line:column, from 0
Dot in Main Main 3:4, Main 0:-1, Main 3:4, Main 5:10
definition of Box null
After (text):
Dot in Main Main 5:10, Lib 4:15
definition of Box Lib 4:21
A copy whose original member is found is no longer a declaration of the
including file: it gets no definition item and no declaration reference,
and the constructors of an included type are not put in the stamp table.
Find References on a value, type or module collects the original member
and all its copies in the file. Constructors and record fields of an
included type are looked up in the type they were copied from, which links
them to their declaration in the other file.
Review: How is the original member found? The copy's module path is
`IncludedModule (source, _)`, so `source.name` is resolved like any other
path. In this file that gives the original stamp.
Review: And when the member is in another file? Find References on the copy
adds the references of the original member, found in its file, to the
copy's own: the uses of the copy in this file and the uses other files
record under this file's path. For a constructor or field the copy has the
other file's stamps, so its uses here are recorded under the other file and
the stamp is not looked up in this file. Going the other way, from a use
linked to the other file, the copies included into this file add the uses
recorded under this file's path. From the declaration in the other file,
uses through this file's path are still not found, as on master.
Review: What about members of a module nested in the included one? A
nested module copied by an include now records itself in its members'
module path, as `ExportedModule` under the `IncludedModule`, and
`Module_path.included_path` rebuilds `source.Nested.name`. Without that,
the copy of `Nested.x` would resolve to `source.x` and merge the
references of the two values.
Review: Why do constructor and field references also go through the
family of their type? Other files reference a constructor of an included
type by the copy's path (`Main.L1`), while uses in the file are linked to
the original type. Each type in the family contributes the references
under its own path. The constructors of a type and of its copies share
stamps, so a location found twice is reported once; a lone stamp is
handled as before.
Review: What if the source can't be resolved, such as a module type
included in a `.resi`, which analysis does not register? Then the copy
stays a declaration, as before.
Fixes: #9323
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGbYDy2DBe5YmGdHTL
Signed-off-by: Christoph Knittel <ck@cca.io>
5bc3c31 to
16f3ab8
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
Editor analysis treated each member copied by an
includeas a declaration of its own, at the position of the original declaration. Constructors keep their original stamps through an include. When they came from another file, those stamps could equal stamps of values in the including file. Find References on such a value then showed duplicates and a0:-1location, and missed the uses in other files. Copies of members from a local functor or module split references between the declaration and the uses.Now a copy whose original member is found is no longer registered as a declaration. Find References gathers the original and all its copies. Constructors and fields of an included type are looked up in the type they come from, so references and go-to-definition reach the declaration in the other file.
New fixtures
IncludeDeclarations.res,IncludeDeclarationsLib.resandIncludeDeclarationsUse.rescover the issue's cases: references on values whose stamps collide, local functor and module includes, nested includes, includes inside a module, constructors from another file's functor, and uses from another file.Fixes #9323
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gGbYDy2DBe5YmGdHTL