Repository navigation
Reconcile upstream through 16bc05a2 (Go asserted locals, native) - #433
Conversation
…he asserted type's method (colbymchenry#2478) Receiver inference read `v := T{}`, `var v T` and parameters, never a local bound from a type assertion. So `flusher.Flush()` after `flusher, ok := w.(http.Flusher)` went to whichever project method name matching picked, and calls like etcd's `fi.Action()` after `fi := s.kvindex.(*fakeIndex)` linked to nothing. A Go local whose declaration in scope at the call binds the value of a type assertion (`v := x.(T)`, `v, ok := x.(T)`, `var v, _ = x.(T)`) now has the asserted type, found where Go finds it, as colbymchenry#2444 does for a call made through the assertion itself (`x.(T).M()`). Calls, method values and field chains through the local (`wr.job.Start()`) reach the type's own method, its interface's, or one embedding promotes into it. The binding is the one the scope reader from colbymchenry#2448 finds in scope at the call: an `if` header's ends with its statement, and a nearer declaration in a block that has ended does not hide it. A type switch's variable and a value that only starts with an assertion (`x.(T).field`) resolve as before. A type from outside the project, a predeclared type or an alias of an outside type links nothing, as for the assertion itself. A type the index can't tell is left to name matching, as before: a type literal (`interface{ GetDeadline() time.Time }`) or a type declared inside a function (grpc-go's `internalInfo` and `grpcstatus`). A local bound from an assertion and named like a standard-library package (`parser, ok := builder.(balancer.ConfigParser)`) is no longer dropped as a call into that package. On etcd, harbor, kratos and grpc-go, 358 call sites change. 216 gain a link, 38 move to the asserted type's method and 89 keep their target, now resolved through the asserted type. 15 lose a link that went through a type from outside the project, or from a field read to a same-named function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the native resolver Upstream colbymchenry#2478 types a Go local bound from a type assertion in the TypeScript name matcher, which the fork replaced with the Rust kernel. The same rule is implemented in codegraph-kernel/src/resolve/go_asserted.rs, reading the declaration in scope from the syntax tree.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The asserted-local resolution change has no identified issue requiring a fix before merge. Pre-merge checks |
|
| Check name | Status | Explanation |
|---|---|---|
| Description Check | Check skipped - CodeRabbit’s high-level summary is enabled. | |
| Title check | The title clearly identifies the upstream reconciliation through commit 16bc05a and the main feature, Go asserted-local resolution. It is concise and related to the changeset. | |
| Linked Issues check | Check skipped because no linked issues were found for this pull request. | |
| Out of Scope Changes check | Check skipped because no linked issues were found for this pull request. | |
| Suppressions Explained | The pull request adds no lint, type-check, or compiler suppression directive. The changed files contain no new eslint-disable, @ts-expect-error, @ts-ignore, #[allow(...)], noqa, or lint/type… |
|
| User-Visible Changes Documented | The pull request changes Go resolver behavior, tests, CHANGELOG.md, and README.md merge-point references. It does not add, remove, or rename a CLI command or flag, MCP tool or argument, supported lang… |
✨ Finishing Touches 💡 1
-
📝 Generate docstrings
-
-
- Commit to this branch
- Create a new PR
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks 💡
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Merges upstream
mainthrough16bc05a2(upstream colbymchenry#2478) intofork/consolidated.colbymchenry#2478: a Go local bound from a type assertion (
f, ok := w.(http.Flusher),wr := v.(*Wrapper)) has the asserted type. Upstream implements it insrc/resolution/name-matcher.ts, which the fork deleted, so the merge keeps that deletion and ports the rule to the native resolver instead:codegraph-kernel/src/resolve/go_asserted.rsreads the declaration of the receiver in scope from the syntax tree (blocks,if/for/switchinitializers, range and type-switch variables, parameters,varspecs; comments declare nothing). A:=orvarwhose whole value is one assertion gives the asserted type; any other declaration leaves the call to the existing strategies.pkg.T, aliases followed. A type from outside the project or a predeclared one links nothing; a type literal or a function-local type is left to the other strategies.register(st.Fetch)), the 2-hop field chain (wr.job.Start()), and the standard-library-package prefilter (a local namedparseris the local).__tests__/go-asserted-locals.test.tsis kept. Two assertions are adapted to the fork's existing rule that a callee is not name-guessed for a receiver whose type the project does not declare: a type-literal / function-local asserted type (Unseen) and a type-switch variable (Switched) stay unlinked where upstream name-matches them tosink::Drain. Both behave this way onfork/consolidatedbefore this change.CHANGELOG: this range's entry; a duplicate of an earlier Go-assertion entry the merge re-inserted is dropped. README merge point moved to
16bc05a2.Checks: full suite 681 files / 8701 tests passed, no worker crashes; golden dumps unchanged;
eval:precision gin3/3 held; kernel built with no warnings.README rows checked: merge point (2 places) updated; no fork-vs-upstream row changes.
Lands as a merge commit (not squash) to keep upstream ancestry.
Summary by CodeRabbit