Repository navigation
feat(resolve): origin through top-level calls + sibling-site scope fixes (slices 2b-3) - #332
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Inferred body origins are still lost, and truncated long signatures can be incorrectly classified as returning Unit.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Extends type-origin tracking through top-level calls and fixes receiver scope selection in resolution and reference verification.
Changes:
- Preserves declaring-file origins for top-level return types.
- Resolves field and receiver types in their declaration scope.
- Adds regression coverage for Kotlin/Java inference and subtype references.
| File | Description |
|---|---|
src/indexer.rs |
Implements origin-aware return lookup. |
src/indexer/infer/chain.rs |
Propagates top-level return origins. |
src/indexer/infer/deps.rs |
Adds origin-aware inference API. |
src/indexer/infer/cst_symbol_tests.rs |
Tests top-level call resolution. |
src/features/references.rs |
Uses receiver type scope for arity lookup. |
src/features/references_verify.rs |
Anchors hierarchy checks to receiver declarations. |
src/resolver/extension.rs |
Separates type and extension scopes. |
src/resolver/infer.rs |
Infers undeclared Kotlin returns and origins. |
src/resolver/infer_tests.rs |
Tests signature and Java behavior. |
src/resolver/mod.rs |
Exports the scoped receiver resolver. |
src/resolver/qualified.rs |
Resolves field types from declaring files. |
src/resolver/tests.rs |
Tests field and receiver scope fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Hessesian
added a commit
that referenced
this pull request
Oct 6, 2026
… not Unit (review on #332) - infer_undeclared_return_type returns (type, origin) via infer_expr_type_with_origin: fun wrapper() = importedFactory() is Payload spelled where importedFactory was declared - SignatureBodyKind::Unknown when the collected signature's parameter list never closes (collect_signature caps at 15 lines); only a closed list with no = is Unit Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…xes (slices 2b-3) - top-level call return types report the file they were written in; a bound Kotlin function with no declared type gets its body's type (with the body expression's origin) or Unit, never from Java, never from a signature the 15-line collection cut short, never when a declared type was cut from detail - value_path_anchor, references_verify's supertype walk and the find-references arity query resolve a receiver's type name in its own scope Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Hessesian
force-pushed
the
feat/receiver-origin-slice2b
branch
from
October 6, 2026 08:52
abd2aea to
a4287ae
Compare
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.

Stacked on #331 (slices 1-2). Base is that branch; retarget to
mainonce #331 merges.Slice 2b — top-level calls
find_fun_return_type_reachable_declared/InferDeps::find_fun_return_type_reachable_with_origin: a bound top-level function's return type reports the file it was written in (the strategy used to assume the caller's file).Unit(Kotlin only), like a member method. A signature with no=after its parameter list isUnitwithout parsing the declaring file.Slice 3 — the same bug at sibling sites
value_path_anchorresolved a field's type name from the caller's file; it was written in the field's declaring file.references_verifystarted the supertype walk from the call site for a Reference candidate, a file that declares nothing of the receiver's type, so a genuine subtype reference was rejected asUnrelated. It now starts from the receiver type's declaring file; unresolvable → kept, never rejected.resolve_receiver_callee_in_type_scopesplits the type scope from the caller (extension scope stays the caller's); used by find-references' arity query.Regressions found and fixed while measuring (each with a red test)
detail(multi-line parameter list) was mistaken for "no type declared" and answeredUnit(MonetasafeFlow→startScoring().collectEmit). The full collected signature is now read first.FormatUtil.formatAmount→Unit, 400+ bogus typed receivers). It is now Kotlin-only.Tests (red before)
top_level_call_member_resolves_in_the_file_the_return_type_was_written_in,top_level_expression_body_call_member_resolves_through_the_inferred_return,value_path_field_type_is_resolved_in_the_fields_declaring_file,subtype_call_site_in_a_file_that_declares_neither_type_is_kept,receiver_callee_resolves_the_receiver_type_name_in_its_own_scope,top_level_return_type_declared_after_a_multi_line_parameter_list_is_not_unit,undeclared_return_inference_never_applies_to_a_java_method,signature_declares_an_expression_body_only_for_an_equals_after_the_parameter_list.cargo test(2049),clippy -D warnings,fmtclean.Moneta (
resolution-accuracy Moneta/android)Run-to-run noise on identical code is about ±0.3pp / ±400 FilteredCandidate (JAR promotion budget).
🤖 Generated with Claude Code