codeql icon indicating copy to clipboard operation
codeql copied to clipboard

Go: extract entities for type parameters

Open owen-mc opened this issue 2 years ago • 1 comments

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.

owen-mc avatar Jan 03 '24 14:01 owen-mc

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 avatar Jan 03 '24 16:01 owen-mc