Skip to content

Go: extract entities for type parameters #15216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Jan 3, 2024

This was overlooked previously. We already do this
for named types. I have confirmed that none of the
other cases in this switch statement are entities, that
is they don't have a field of type object that can
be accessed using Obj().

The test change will mean that for future Go version updates, changes in type parameters for library functions will not cause our test to fail.

smowton
smowton previously approved these changes Jan 3, 2024
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-confidence approval as I have only a hazy memory of what the type <-> object relation does.

@owen-mc owen-mc force-pushed the go/extract-objects-for-type-parameters branch from b90a074 to 915a33a Compare January 3, 2024 16:02
@owen-mc owen-mc marked this pull request as draft January 3, 2024 16:10
@owen-mc
Copy link
Contributor Author

owen-mc commented Jan 3, 2024

Making this a draft as it needs some more work before it is reviewed again.

The below test failures indicate that something is going wrong and we are extracting two different objects for the same type, which contradicts restrictions we put on that table. I need to think a bit more about type equality and whether we are doing the right thing and should lift the restrictions (my current hunch) or we are doing the wrong thing.

[INVALID_KEY] predicate type_objects(@type tp, @object object): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 1:
Tuple 1 in row 209: (6755,6758)
Tuple 2 in row 210: (6755,17765)
[INVALID_KEY] predicate type_objects(@type tp, @object object): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 1:
Tuple 1 in row 235: (7289,7292)
Tuple 2 in row 236: (7289,17831)
[INVALID_KEY] predicate type_objects(@type tp, @object object): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 1:
Tuple 1 in row 238: (7298,7301)
Tuple 2 in row 239: (7298,17828)
[INVALID_KEY] predicate type_objects(@type tp, @object object): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 1:
Tuple 1 in row 241: (7312,7315)
Tuple 2 in row 242: (7312,17825)
[INVALID_KEY] predicate type_objects(@type tp, @object object): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 1:
Tuple 1 in row 245: (7332,7335)
Tuple 2 in row 246: (7332,17834)
[INVALID_KEY] predicate type_objects(@type tp, @object object): More errors, not displayed. There are 10 pairs of tuples not satisfying the key dependency for a relation of size 703
Dataset check of /home/runner/work/codeql/codeql/go/extractor-smoke-test/testdb/db-go complete with 6 violations.

@owen-mc owen-mc force-pushed the go/extract-objects-for-type-parameters branch 7 times, most recently from f0a3464 to 1180d8c Compare June 8, 2024 22:37
@owen-mc owen-mc force-pushed the go/extract-objects-for-type-parameters branch from 1180d8c to b2560d0 Compare June 12, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants