Repository navigation
Conversation
Changelog🐛 Bug fix
Semantic Diff1 commit · Full page Find references written through another module path0d4b271 · cknitt + Claude · Nov 19, 2026, 06:14 UTC
References modified (functor application used from another file) // Fn.res
module type Ord = {
type t
}
module IntOrd = {
type t = int
}
module MakeSet = (O: Ord) => {
let add = (x: O.t) => [x]
}
module MakeTwo = (A: Ord, B: Ord) => {
let pair = 1
}
module First = MakeTwo(IntOrd)
// Use.res
module S = Fn.MakeSet(Fn.IntOrd)
let s = S.add(1)
module Make = Fn.MakeSet
module Aliased = Make(Fn.IntOrd)
let a = Aliased.add(1)
module Fin = Fn.First(Fn.IntOrd)
let p = Fin.pair
// Far.res
let f = Use.S.add(2)
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
+Far.res 1:15 Use.S.add
Fn.res 11:7 let pair
+Use.res 7:13 Fin.pair
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
+Far.res 1:15 Use.S.addRename modified (functor application used from another file)
Fn.res let add ⇝ let plus
Use.res S.add ⇝ S.plus
Use.res Aliased.add ⇝ Aliased.plus
+Far.res Use.S.add ⇝ Use.S.plusReferences modified (value of a namespaced dependency) // NsUtils.res in a dependency with namespace NsDep
module Plain = {
let plain = 1
}
// Main.res
let p = NsDep.NsUtils.Plain.plain
module P = NsDep.NsUtils.Plain
let q = P.plain
-NsUtils.res 2:7 let plain
+NsUtils.res 2:7 let plain
+Main.res 1:29 NsDep.NsUtils.Plain.plain
+Main.res 3:11 P.plainReview
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix-9322-definition-file #9329 +/- ##
=========================================================
Coverage 82.16% 82.17%
=========================================================
Files 456 456
Lines 65664 65683 +19
=========================================================
+ Hits 53953 53974 +21
+ Misses 11711 11709 -2
🚀 New features to boost your workflow:
|
✅ Compiler benchmarksAllocated wordsIn total: 639,844,209 → 639,843,205 (±0.00%). Generated projects: 629,805,995 → 629,805,044 (±0.00%). None of the 265 benchmarks changed by 0.1% or more. InstructionsIn total: 9,210,459,675 → 9,210,459,675 (±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 0d4b271 compared with base 39b1a9e in this run. |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
@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. |
|
Codex Review: Didn't find any major issues. Breezy! 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:
A use in another file is recorded under the path it is written with,
such as Use.S.add for a functor application S in Use.res. Find
References looked only under the declaration's own path
(Fn.MakeSet.add), so it missed uses through the file that applies a
functor, through a partial application, and plain values of a
namespaced dependency. Rename then left these uses unchanged and the
code stopped compiling.
Find References now also takes a recorded path that ends in the
declaration's name and resolves it, and keeps it when it resolves to
the declaration or its .res/.resi counterpart.
References modified (functor application used from another file):
Example:
// Fn.res
module type Ord = {
type t
}
module IntOrd = {
type t = int
}
module MakeSet = (O: Ord) => {
let add = (x: O.t) => [x]
}
module MakeTwo = (A: Ord, B: Ord) => {
let pair = 1
}
module First = MakeTwo(IntOrd)
// Use.res
module S = Fn.MakeSet(Fn.IntOrd)
let s = S.add(1)
module Make = Fn.MakeSet
module Aliased = Make(Fn.IntOrd)
let a = Aliased.add(1)
module Fin = Fn.First(Fn.IntOrd)
let p = Fin.pair
// Far.res
let f = Use.S.add(2)
Before (text): references of add in Fn.res
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
After (text): references of add in Fn.res
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
Far.res 1:15 Use.S.add
Before (text): references of pair in Fn.res
Fn.res 11:7 let pair
After (text): references of pair in Fn.res
Fn.res 11:7 let pair
Use.res 7:13 Fin.pair
Before (text): references of Use.S.add in Far.res
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
After (text): references of Use.S.add in Far.res
Fn.res 8:7 let add
Use.res 2:11 S.add
Use.res 5:17 Aliased.add
Far.res 1:15 Use.S.add
Rename modified (functor application used from another file):
Before (text): rename Use.S.add in Far.res to plus
Fn.res let add ⇝ let plus
Use.res S.add ⇝ S.plus
Use.res Aliased.add ⇝ Aliased.plus
After (text): rename Use.S.add in Far.res to plus
Fn.res let add ⇝ let plus
Use.res S.add ⇝ S.plus
Use.res Aliased.add ⇝ Aliased.plus
Far.res Use.S.add ⇝ Use.S.plus
References modified (value of a namespaced dependency):
Example:
// NsUtils.res in a dependency with namespace NsDep
module Plain = {
let plain = 1
}
// Main.res
let p = NsDep.NsUtils.Plain.plain
module P = NsDep.NsUtils.Plain
let q = P.plain
Before (text): references of plain in Main.res
NsUtils.res 2:7 let plain
After (text): references of plain in Main.res
NsUtils.res 2:7 let plain
Main.res 1:29 NsDep.NsUtils.Plain.plain
Main.res 3:11 P.plain
Review: Why not record each use under its declaration's key? Recording
happens per file, without access to the other files a path goes through.
Resolving at search time needs no change to the recorded data.
Review: Does this slow down Find References on large projects? Only
recorded paths that end in the declaration's name are resolved, each
distinct path once. On a 305-file project, references on a value of
Big.res take 0.27 s before and after.
Review: Why keep the exact match on the declaration's own path? It is
the common case and needs no resolution, and it keeps every result the
old search found.
Fixes: #9321
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>
464c187 to
0d4b271
Compare
Find References and Rename missed uses in other files written through a different module path than the declaration's: through the file that applies a functor (
Use.S.add), through a partial application (Fn.First(Fn.IntOrd)), and plain values of a namespaced dependency. Rename left these uses unchanged, so the code stopped compiling.Find References now resolves the paths recorded in other files when they end in the declaration's name, and keeps those that lead to the declaration. Each path is resolved once per search; on a 305-file project the time is unchanged.
Stacked on #9328, which reads a functor alias under the type checker's implicit constraint as the alias, so uses through
Aliased = Make(...)are recorded under the functor's own path.New tests:
PathRefs.res,PathRefsUse.resandPathRefsFar.rescover references and rename through a functor application in another file, a functor alias, a partial application, and constructors. A new namespaced dependency intests-sourcedirs-dependencycovers references to a value of a namespaced dependency, written directly and through a module alias.Fixes #9321
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gGbYDy2DBe5YmGdHTL