Repository navigation
Share the load-path lookup, polyvariant label printing and ident tables - #8990
Conversation
Why:
The same logic was kept in several copies that had to change together.
Misc.find_map_in_path_uncap is now the one "name as written, then
uncapitalized" lookup, used by Misc.find_in_path_uncap, Config_util
and Bs_cmi_load (#8925 had changed all three). Editor completion prints
polyvariant labels with Res_printer.print_poly_var_ident instead of a
copy of the printer's classifier, which had drifted. Lam_check and
Lam_dce use Hash_ident, which Hash_set_ident duplicated since #8787.
Format modified (completion label of a polymorphic variant):
Example:
type t = [#644 | #""]
let f = (e: t) => ignore(e)
// f()
// ^com
Before (text):
#"644"
#
After (text):
#644
#""
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe
Semantic Diff1 commit · Full page Share the load-path lookup, polyvariant label printing and ident tablesbb32126 · Christoph Knittel with Claude Opus 5.5 · Oct 23, 2026
Format modified (completion label of a polymorphic variant) type t = [#644 | #""]
let f = (e: t) => ignore(e)
// f()
// ^com
-#"644"
-#
+#644
+#"" |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8990 +/- ##
=======================================
Coverage 81.22% 81.23%
=======================================
Files 457 456 -1
Lines 63862 63834 -28
=======================================
- Hits 51875 51854 -21
+ Misses 11987 11980 -7
🚀 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-8990 |
|
@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. |
Fixes #8976.
This removes the three duplicated pieces of logic the issue lists:
Misc.find_map_in_path_uncap path name fis now the only implementation of "the name as written, then uncapitalized, in each directory".Misc.find_in_path_uncap, the newMisc.find_in_path_uncap_opt(used byConfig_util.find_opt, replacing its private copy) andBs_cmi_load.load_cmiall go through it.Bs_cmi_loadpasses a function that opens and parses each candidate, so it keeps its single-open behaviour on case-insensitive file systems. The existingounit_find_in_path_testsalready check the lookup order through all three callers.Utils.print_maybe_exotic_ident, a copy ofRes_printer.classify_ident_content, is removed. Its only caller, the polyvariant completion intype_utils.ml, now usesRes_printer.print_poly_var_ident. That fixes the two places where the copies had diverged: the label644is now completed as#644instead of#"644", and the empty label as#""instead of a bare#.Hash_set_ident.lam_check.mlandlam_dce.mluseHash_ident(onlycreate,memandadd), and the duplicate module is deleted.Tests
exoticPolyvariantintests/analysis_tests/tests/src/CompletionExpressions.resgains#644and#"". It is extended on its existing line, so later test positions don't move, and the completion snapshot shows both labels.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe