checklocks: fix generics Origin fact lookup#12443
Merged
copybara-service[bot] merged 1 commit intogoogle:masterfrom Jan 7, 2026
Merged
checklocks: fix generics Origin fact lookup#12443copybara-service[bot] merged 1 commit intogoogle:masterfrom
copybara-service[bot] merged 1 commit intogoogle:masterfrom
Conversation
Contributor
Author
|
@EtiennePerot would you mind having a look? |
68bde13 to
15bbe2c
Compare
checklocks attaches lock facts to the declaration objects produced by
go/types, but SSA analysis of generic code can observe instantiated
`*types.Var/*types.Func` objects instead. Importing facts from those
instantiated objects fails, which causes spurious inference warnings
("may require checklocks annotation...") and can miss expected
checklocksfail reports.
Fix this by falling back to Origin() when importing lock guard and
function facts, and by normalizing inference observation keys to the
origin object so inference uses the same fact identity as export.
Add regression coverage for generic methods and functions, including a
cross-package generics.
15bbe2c to
9fc2083
Compare
Contributor
Author
|
@kakkoyun FYI |
copybara-service bot
pushed a commit
that referenced
this pull request
Jan 7, 2026
checklocks attaches lock facts to the declaration objects produced by
go/types, but SSA analysis of generic code can observe instantiated
`*types.Var/*types.Func` objects instead. Importing facts from those
instantiated objects fails, which causes spurious inference warnings
("may require checklocks annotation...") and can miss expected
checklocksfail reports.
Fix this by falling back to Origin() when importing lock guard and
function facts, and by normalizing inference observation keys to the
origin object so inference uses the same fact identity as export.
Add regression coverage for generic methods and functions, including a
cross-package generics.
Fixes #10372.
Fixes #11671.
Closes #11740.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#12443 from tamird:checklocks-generic 9fc2083
PiperOrigin-RevId: 853130453
kakkoyun
approved these changes
Jan 7, 2026
kakkoyun
left a comment
There was a problem hiding this comment.
LGTM! Thanks for taking care of it!
ayushr2
approved these changes
Jan 7, 2026
copybara-service bot
pushed a commit
that referenced
this pull request
Jan 7, 2026
checklocks attaches lock facts to the declaration objects produced by
go/types, but SSA analysis of generic code can observe instantiated
`*types.Var/*types.Func` objects instead. Importing facts from those
instantiated objects fails, which causes spurious inference warnings
("may require checklocks annotation...") and can miss expected
checklocksfail reports.
Fix this by falling back to Origin() when importing lock guard and
function facts, and by normalizing inference observation keys to the
origin object so inference uses the same fact identity as export.
Add regression coverage for generic methods and functions, including a
cross-package generics.
Fixes #10372.
Fixes #11671.
Closes #11740.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#12443 from tamird:checklocks-generic 9fc2083
PiperOrigin-RevId: 853130453
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.
checklocks attaches lock facts to the declaration objects produced by
go/types, but SSA analysis of generic code can observe instantiated
*types.Var/*types.Funcobjects instead. Importing facts from thoseinstantiated objects fails, which causes spurious inference warnings
("may require checklocks annotation...") and can miss expected
checklocksfail reports.
Fix this by falling back to Origin() when importing lock guard and
function facts, and by normalizing inference observation keys to the
origin object so inference uses the same fact identity as export.
Add regression coverage for generic methods and functions, including a
cross-package generics.
Fixes #10372.
Fixes #11671.
Closes #11740.