Repository navigation
detector (ts/js): name a quoted method key after a modifier by the key, not the modifier (#3760) - #3764
Merged
Conversation
…y, not the modifier (#3760) `async "array-objects"() {}` (zod packages/bench/compile-vs-arktype.ts:414) was extracted as a function named `async`. The brace-safe stream blanks the whole string literal, quotes included, so func_start saw `async () {` and captured the modifier as the name (typescript through its name group, javascript through the bare match). _ts_js_quoted_method_name reads the key back from the raw code when the captured name is one of _TS_JS_RESERVED_MODIFIER_KEYWORDS and a quoted literal sits between it and the parameter list (bounded regex). The name keeps its quotes, as groovy's quoted method names already do; a quoted key is never reachable by a bare call, so it cannot collide in the resolver. A method really named `get()`/`async()` has no literal there and keeps its name. zod (TypeScript Level 2 gate): 1,519 -> 1,527 judged confident links, recall 56.9% -> 57.2%, unmapped 224 -> 216; baseline regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Contributor
2 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3760.
async "array-objects"() {}(zodpackages/bench/compile-vs-arktype.ts:414) was extracted as a function namedasync.Root cause: the brace-safe stream blanks the whole string literal, quotes included. So
func_startseesasync () {and captures the modifier as the name. TypeScript captures it through its name group. JavaScript's match has no group and simply ends atasync.Fix (
gitgalaxy/core/detector.py):_ts_js_quoted_method_nameruns only when the captured name, or the match's last token, is one of the existing_TS_JS_RESERVED_MODIFIER_KEYWORDS(#2278). It then reads the raw code right after it. If a quoted literal sits there before the parameter list (an optional<T>is allowed), the unit takes that key as its name."array-objects"), the convention Groovy's quoted method names already follow in_extract_name. A quoted key can never be reached by a bare call, so it can't collide with another name in the call resolver.get()orstatic async()has no literal after the name, so it keeps its name. The test covers both.Not in scope:
"plain-key"() {}with no modifier in front is still not extracted at all. The blanked key leaves nothing forfunc_startto match. That's a recall gap, not this naming bug, and belongs in a follow-up.Measured on zod (TypeScript Level 2 gate, #3761)
tests/call_graph_resolution_typescript_baseline.jsonis regenerated to lock this in.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
ruff_audit.py --cianddead_key_audit.py --ciare OK.tests/core_engine/test_detector.pypasses, 201 tests including the newtest_detector_ts_js_quoted_method_key_after_modifier_is_not_named_by_the_modifier. The TS/JS extraction and strict suites plustest_call_resolver.pypass, 405 tests.crucible_check.py, zero-dependency: PASS, no golden-master drift. Full-precision could not run locally: this environment's network policy blocks tiktoken'scl100k_basedownload. Name extraction doesn't depend on the mode, so CI'scrucible-audit (full-precision)is the check for that half.tree_sitter_accuracy_audit.py --ci --all: all OK, 30 languages.Differential Scan target
https://github.com/colinhacks/zod (pinned in
tests/import_graph_corpus.json)Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Generated by Claude Code