Skip to content

Fix editor references for members brought in by include - #9331

Merged
cknitt merged 3 commits into
masterfrom
fix-9323-include-declarations
Dec 4, 2026
Merged

cknitt merged 3 commits into
masterfrom
fix-9323-include-declarations

Conversation

@cknitt

@cknitt cknitt commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Editor analysis treats each member copied by an include as a declaration of its own, at the position of the original declaration. This causes two problems:

  • Find References on a member of a local module or functor that is included elsewhere splits into two sets: the declaration with its direct uses, and the uses of the included copy.
  • An include does not rename constructors and record fields, so constructors and fields of an included type keep the stamps of their original declaration, possibly from another compilation. These stamps can equal stamps of values in the including file. Find References on such a value then shows duplicates and 0:-1 locations, and misses uses in other files.

With this change:

  • A copy whose original member is found is no longer a declaration. Find References on a member gathers the original and all its copies, in this file, in the other file of a .res/.resi pair, and, for a member included from another file, in that file too.
  • This also holds in a module that shadows an included member, which the type checker constrains to its own signature, and for include module type of M in a signature.
  • Constructors and record fields read from a signature get stamps of their own, numbered per file, so they can't collide with the file's values. Go to definition on them follows the copy to the type it comes from.
  • References at ghost locations, such as members read from a signature, are dropped, so there are no more 0:-1 entries.
  • Find References reads the other files of the project once per query, whatever the number of copies. On a 310-file project, a member with eight copies takes the same time as on master.

New tests: IncludeDeclarations.res, IncludeDeclarationsLib.res and IncludeDeclarationsUse.res cover colliding stamps, includes of local functors and modules, nested includes, includes inside a module, several copies of one member, constructors and fields from another file's functor, and uses from another file. IncludeDeclarationsParam.res, IncludeDeclarationsSig.res and IncludeDeclarationsUnpack.res cover include of a functor parameter and include unpack(...). IncludeDeclarationsOverride.res covers includes with a shadowed member, also from another file. IncludeDeclarationsIntf.res(i) with IncludeDeclarationsIntfUse.res, and IncludeDeclarationsTypeOf.res(i), cover a module with an interface and include module type of.

Not found: uses through the including file's path when Find References starts from the original declaration in another file, and constructors and fields of a module type used through another module type that includes it.

Fixes #9323

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gGbYDy2DBe5YmGdHTL

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Changelog

🐛 Bug fix

  • Editor: find references, definition and rename handle members brought in by include correctly, without duplicate or wrong locations.

Semantic Diff

3 commits · Full page

Treat included members as copies of their declarations in editor analysis

ec1b6e3 · cknitt + Claude · Dec 03, 2026, 20:04 UTC

Why

An include copies the members of a module under new stamps, at the positions of the original declarations. Analysis registers each copy as a declaration of the including file, so Find References on a member splits into the declaration with its direct uses and the uses of the copy (fv below).

Constructors and record fields keep their identifiers through an include. When they come from another file's compilation, their stamps can equal stamps of values in the including file (Dot and Box below have the stamps of v0 and v1). Find References on such a value then lists wrong and 0:-1 locations and misses its uses in other files.

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

text · Before: line:column, from 0

-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:8

References 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)

text · Before: line:column, from 0

-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:21

References modified (include with a shadowed member)

module Base = {
  type t = A | B
  type r = {f: int}
  let bv = 1
  let other = 2
}
module Over = {
  include Base
  let other = 3
}
let a = Over.A
let f = (x: Over.r) => x.f
let b = Over.bv + Base.bv
let o = Over.other

text · Before: line:column, from 0

-Over.A       1:11, 0:-1, 0:-1, 10:13
-x.f          2:12, 0:-1, 0:-1, 11:25
-Over.bv      3:6, 3:6, 3:6, 12:13
-Over.other   8:6, 8:6, 8:6, 13:13
+Over.A       1:11, 10:13
+x.f          2:12, 11:25
+Over.bv      3:6, 12:13, 12:23
+Over.other   8:6, 13:13

References modified (include module type of)

// M.res
module Base = {
  let bv = 1
}
include Base

// M.resi
module Base: {
  let bv: int
}
include module type of Base

text · Before: bv in Base, line:column, from 0

-M.resi 1:2 (all of `let bv: int`), M.res 1:6
+M.resi 1:6, M.res 1:6

A copy whose original member is found is not a declaration of the including file: it has no definition item and no declaration reference. The original is found from the copy's module path, which names the included module source and the modules a nested copy sits in: the copy of x in a nested Inner resolves to source.Inner.x. Other files reach that copy under its full path, such as Main.Inner.x.

Find References on a value, type or module gathers the original member and all its copies in the file and in the other file of a .res/.resi pair, and the original's references in its own file when it is in another one. Constructors and fields go through their type. The uses that other files record for all of them are collected in one pass over the project, under their paths or under other paths that resolve to them. Go to definition on a constructor or field of a copied type goes to the one it copies.

A module that shadows a member it includes gets an implicit constraint to its own signature. Its members, read again from that signature, keep what the structure gave them, so its copies stay copies, and each member is declared once. include module type of M in a signature is an include of M.

Constructors and record fields read from a signature (an include, a module type, a functor parameter) get stamps of their own. References at ghost locations, such as those of members read from a signature, are dropped, so there are no 0:-1 entries.

Review

  • Why fresh stamps for constructors and fields of signatures? An include or a module type keeps their identifiers, and a signature from another file brings that compilation's stamps, which can equal stamps of this one. Fresh stamps avoid that wherever the signature comes from, also for include unpack(...) and for a functor parameter, where no original can be resolved. They count down from -2, because 0 marks a persistent identifier and -1 a hidden one. The numbering restarts for each file, so reading a file twice gives the same stamps.
  • What does the project scan cost? Find References reads each file of the project, and the other file of a .res/.resi pair, once per query, whatever the number of copies.
  • Why does the Hover snapshot change? @react.component adds a second make, so the module was read twice and x was declared twice. With one declaration, the JSX heuristic no longer runs; the hover text is the same.
  • What is not found? From the declaration in another file, uses through the including file's copy, such as Main.Dot or Main.made, are not found, as on master. Constructors and fields of a module type S used through another module type that includes it, as with module type S2 = { include S }, module M: S and a parameter X: S2, are not connected. On master they were, only through shared stamps and with 0:-1 entries. Values already behave this way.
Follow each member of another file once, and only members of the file

2340a38 · cknitt + Claude · Dec 04, 2026, 11:03 UTC

Why

When a .res and its .resi reach the same declaration through different includes, Find References walked that declaration twice, listed its locations twice, and rename made two identical edits for each, which editors can reject. And a path into the other file of a module could resolve through an alias into a third file, whose stamp was then taken for a member of the other file: Find References and rename reached an unrelated declaration.

References modified (converging include chains)

// Lib.res
let x = 1
let y = x

// Mid.res
include Lib

// A.res
include Mid

// A.resi
include module type of Lib

// Use.res
let u = A.x

text · Before: A.x in Use, line:column, from 0

-Use 0:10, Lib 0:4, Lib 1:8, Lib 0:4, Lib 1:8
+Use 0:10, Lib 0:4, Lib 1:8

References modified (alias into another file)

// Lib.res
let a0 = 0
module Inner = {
  let iv = 1
}

// Main.res, where a0 has the stamp that iv has in Lib
include Lib

// Main.resi
module Inner: {
  let iv: int
}

// Use.res
let v = Main.Inner.iv

text · Before: Main.Inner.iv in Use, line:column, from 0

-Use 0:19, Lib 0:4 (a0), Main.resi 1:6
+Use 0:19, Main.resi 1:6

Find References remembers the members of other files it has followed, which also bounds the walk. The lookup of a path in a module of another file is one helper.

✨ Gather each family of copies in another file once

bd8c8ca · cknitt + Claude · Dec 04, 2026, 12:55 UTC · new

Why

Find References remembered only the member of another file it followed, but gathers that member's whole family of copies. A second include chain to another member of the family gathered it again, so locations and rename edits came twice.

References modified (two chains into one family)

// Lib.res
module Base = {
  let x = 1
}
include Base
let y = x

// A.res
include Lib

// A.resi
include module type of Lib.Base

// Use.res
let u = A.x

text · Before: A.x in Use, line:column, from 0

-Use 0:10, Lib 4:8, Lib 1:6, Lib 4:8, Lib 1:6
+Use 0:10, Lib 4:8, Lib 1:6

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.16590% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.67%. Comparing base (e489471) to head (bd8c8ca).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
analysis/src/references.ml 92.05% 12 Missing ⚠️
analysis/src/process_cmt.ml 86.95% 3 Missing ⚠️
analysis/src/process_extra.ml 94.44% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9331      +/-   ##
==========================================
+ Coverage   82.59%   82.67%   +0.08%     
==========================================
  Files         468      469       +1     
  Lines       66296    66553     +257     
==========================================
+ Hits        54754    55023     +269     
+ Misses      11542    11530      -12     
Files with missing lines Coverage Δ
analysis/src/shared_types.ml 84.32% <100.00%> (+0.74%) ⬆️
analysis/src/process_extra.ml 87.50% <94.44%> (+0.15%) ⬆️
analysis/src/process_cmt.ml 87.30% <86.95%> (+2.30%) ⬆️
analysis/src/references.ml 79.21% <92.05%> (+5.42%) ⬆️

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

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 656,848,396 → 656,848,245 (±0.00%).

Generated projects: 629,104,154 → 629,104,943 (±0.00%).

None of the 265 benchmarks changed by 0.1% or more.

Instructions

In total: 8,978,951,125 → 8,978,951,125 (±0.00%).

None of the 33 benchmarks changed by 0.1% or more.

Output size

In total: 27,578,382 → 27,578,382 (±0.00%).

None of the 13 benchmarks changed by 0.1% or more.

Pull request bd8c8ca compared with base f28cde7 in this run.

@pkg-pr-new

pkg-pr-new Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: bd8c8ca

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T12:59:41.783966Z bd8c8ca 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread analysis/src/process_extra.ml Resolved
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 73f322a to 610362c Compare November 19, 2026 08:09
@cknitt

cknitt commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread analysis/src/references.ml Resolved
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 610362c to 5bc3c31 Compare November 19, 2026 10:22
@cknitt

cknitt commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread analysis/src/process_extra.ml Resolved
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 5bc3c31 to 16f3ab8 Compare November 19, 2026 10:45
@cknitt

cknitt commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 16f3ab84c3

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

@cknitt

cknitt commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f00fc1e421

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

@cknitt
cknitt force-pushed the fix-9323-include-declarations branch 2 times, most recently from bfe8b5e to 8745394 Compare November 23, 2026 06:47
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 8745394 to 74c7fef Compare November 30, 2026 09:44
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 3c61679 to 63fe1e1 Compare December 3, 2026 20:05
@cknitt
cknitt marked this pull request as ready for review December 4, 2026 06:59
@cknitt

cknitt commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 63fe1e1a1f

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

…ysis

Why:
    An `include` copies the members of a module under new stamps, at the
    positions of the original declarations. Analysis registers each copy
    as a declaration of the including file, so Find References on a member
    splits into the declaration with its direct uses and the uses of the
    copy (`fv` below).

    Constructors and record fields keep their identifiers through an
    include. When they come from another file's compilation, their stamps
    can equal stamps of values in the including file (`Dot` and `Box`
    below have the stamps of `v0` and `v1`). Find References on such a
    value then lists wrong and `0:-1` locations and misses its uses in
    other files.

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

References modified (include with a shadowed member):
Example:
    module Base = {
      type t = A | B
      type r = {f: int}
      let bv = 1
      let other = 2
    }
    module Over = {
      include Base
      let other = 3
    }
    let a = Over.A
    let f = (x: Over.r) => x.f
    let b = Over.bv + Base.bv
    let o = Over.other
Before (text): line:column, from 0
    Over.A       1:11, 0:-1, 0:-1, 10:13
    x.f          2:12, 0:-1, 0:-1, 11:25
    Over.bv      3:6, 3:6, 3:6, 12:13
    Over.other   8:6, 8:6, 8:6, 13:13
After (text):
    Over.A       1:11, 10:13
    x.f          2:12, 11:25
    Over.bv      3:6, 12:13, 12:23
    Over.other   8:6, 13:13

References modified (include module type of):
Example:
    // M.res
    module Base = {
      let bv = 1
    }
    include Base

    // M.resi
    module Base: {
      let bv: int
    }
    include module type of Base
Before (text): bv in Base, line:column, from 0
    M.resi 1:2 (all of `let bv: int`), M.res 1:6
After (text):
    M.resi 1:6, M.res 1:6

A copy whose original member is found is not a declaration of the
including file: it has no definition item and no declaration reference.
The original is found from the copy's module path, which names the
included module `source` and the modules a nested copy sits in: the copy of
`x` in a nested `Inner` resolves to `source.Inner.x`. Other files reach
that copy under its full path, such as `Main.Inner.x`.

Find References on a value, type or module gathers the original member and
all its copies in the file and in the other file of a .res/.resi pair, and
the original's references in its own file when it is in another one.
Constructors and fields go through their type. The uses that other files
record for all of them are collected in one pass over the project, under
their paths or under other paths that resolve to them. Go to definition on a constructor or field of a copied
type goes to the one it copies.

A module that shadows a member it includes gets an implicit constraint to
its own signature. Its members, read again from that signature, keep what
the structure gave them, so its copies stay copies, and each member is
declared once. `include module type of M` in a signature is an include of
`M`.

Constructors and record fields read from a signature (an include, a module
type, a functor parameter) get stamps of their own. References at ghost
locations, such as those of members read from a signature, are dropped, so
there are no `0:-1` entries.

Review: Why fresh stamps for constructors and fields of signatures? An
include or a module type keeps their identifiers, and a signature from
another file brings that compilation's stamps, which can equal stamps of
this one. Fresh stamps avoid that wherever the signature comes from, also
for `include unpack(...)` and for a functor parameter, where no original
can be resolved. They count down from -2, because 0 marks a persistent
identifier and -1 a hidden one. The numbering restarts for each file, so
reading a file twice gives the same stamps.

Review: What does the project scan cost? Find References reads each file of
the project, and the other file of a .res/.resi pair, once per query,
whatever the number of copies.

Review: Why does the Hover snapshot change? `@react.component` adds a second
`make`, so the module was read twice and `x` was declared twice. With one
declaration, the JSX heuristic no longer runs; the hover text is the same.

Review: What is not found? From the declaration in another file, uses
through the including file's copy, such as `Main.Dot` or `Main.made`, are
not found, as on master. Constructors and fields of a module type `S` used
through another module type that includes it, as with
`module type S2 = { include S }`, `module M: S` and a parameter `X: S2`,
are not connected. On master they were, only through shared stamps and
with `0:-1` entries. Values already behave this way.

Fixes: #9323
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGbYDy2DBe5YmGdHTL
Claude-Session: https://claude.ai/code/session_01Kbf3gGgQuXy1xmZbjATZsB
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the fix-9323-include-declarations branch from 63fe1e1 to ec1b6e3 Compare December 4, 2026 09:14
@cknitt

cknitt commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec1b6e3e6b

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

Comment thread analysis/src/references.ml Resolved
Why:
    When a .res and its .resi reach the same declaration through different
    includes, Find References walked that declaration twice, listed its
    locations twice, and rename made two identical edits for each, which
    editors can reject. And a path into the other file of a module could
    resolve through an alias into a third file, whose stamp was then taken
    for a member of the other file: Find References and rename reached an
    unrelated declaration.

References modified (converging include chains):
Example:
    // Lib.res
    let x = 1
    let y = x

    // Mid.res
    include Lib

    // A.res
    include Mid

    // A.resi
    include module type of Lib

    // Use.res
    let u = A.x
Before (text): A.x in Use, line:column, from 0
    Use 0:10, Lib 0:4, Lib 1:8, Lib 0:4, Lib 1:8
After (text):
    Use 0:10, Lib 0:4, Lib 1:8

References modified (alias into another file):
Example:
    // Lib.res
    let a0 = 0
    module Inner = {
      let iv = 1
    }

    // Main.res, where a0 has the stamp that iv has in Lib
    include Lib

    // Main.resi
    module Inner: {
      let iv: int
    }

    // Use.res
    let v = Main.Inner.iv
Before (text): Main.Inner.iv in Use, line:column, from 0
    Use 0:19, Lib 0:4 (a0), Main.resi 1:6
After (text):
    Use 0:19, Main.resi 1:6

Find References remembers the members of other files it has followed, which
also bounds the walk. The lookup of a path in a module of another file is
one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGgQuXy1xmZbjATZsB
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt

cknitt commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2340a383a0

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

Comment thread analysis/src/references.ml Resolved
Why:
    Find References remembered only the member of another file it followed,
    but gathers that member's whole family of copies. A second include chain
    to another member of the family gathered it again, so locations and
    rename edits came twice.

References modified (two chains into one family):
Example:
    // Lib.res
    module Base = {
      let x = 1
    }
    include Base
    let y = x

    // A.res
    include Lib

    // A.resi
    include module type of Lib.Base

    // Use.res
    let u = A.x
Before (text): A.x in Use, line:column, from 0
    Use 0:10, Lib 4:8, Lib 1:6, Lib 4:8, Lib 1:6
After (text):
    Use 0:10, Lib 4:8, Lib 1:6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGgQuXy1xmZbjATZsB
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt

cknitt commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: bd8c8ca0f3

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

@cknitt
cknitt merged commit 2796a44 into master Dec 4, 2026
22 checks passed
@cknitt
cknitt deleted the fix-9323-include-declarations branch December 4, 2026 13:22
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.

Editor analysis registers included members as separate declarations

2 participants