docs: update D1 design to reflect pointer-identity implementation#151
Open
yvonnedevlinrh wants to merge 2 commits into
Open
docs: update D1 design to reflect pointer-identity implementation#151yvonnedevlinrh wants to merge 2 commits into
yvonnedevlinrh wants to merge 2 commits into
Conversation
, unbound-force#144, unbound-force#145) - Add isExternallyObservable helper using types.Object pointer identity to distinguish parameters/receivers/named-returns from body-local variables - Gate MapMutation, SliceMutation, ChannelSend, ChannelClose emission behind scope check — local variables no longer produce false positives - Add collectSignatureVars to build signature-level variable set from info.Defs - Thread info *types.Info to detectSendEffects for scope resolution - Add 6 test fixtures and 6 tests covering local suppression, named return detection, and receiver field access
The design document's D1 section showed scope-depth counting (v.Parent().Parent().Parent() == types.Universe) for identifying signature-level variables. The implementation correctly pivoted to types.Object pointer identity via collectSignatureVars after discovering that Go's type checker inserts a file scope between package and function scopes, making depth counting unreliable. Update the design document to match the actual implementation and document the scope hierarchy correction. Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Yvonne Devlin <ydevlin@redhat.com>
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
Blocked by: #149 (must merge first - this branch is based on it)
Updates the p1-local-var-false-positives design document (D1 section) to
match the actual implementation. The design described scope-depth counting
(
v.Parent().Parent().Parent() == types.Universe) for identifyingsignature-level variables, but the implementation correctly pivoted to
types.Objectpointer identity viacollectSignatureVarsafter discoveringthat Go's type checker inserts a file scope between package and function
scopes, making depth counting unreliable.
Changes
approach (
collectSignatureVars+sigVars[obj])isExternallyObservablesignature to includesigVarsparameterUniverse - Package - File - FuncType - FuncBodyTesting
Follow-up to PR #149.