Go: fix database inconsistency when receiver has alias type #19464
+5
−12
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.
It was reported that
codeql/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls
failsDB-CHECK
if you add--check-databases
to the test target ofcodeql/go/Makefile
. This turns out to be because that test has a method defined on a receiver which is an aliasImpl6Alias
of the typeImpl6
. This is equivalent to defining the method onImpl6
directly. There is some code in the extractor which makes sure that objects which are receiver variables get a special label which is the same when seen from different files. That code was not unaliasing the type of the receiver. This PR fixes that, which fixes the db inconsistency.I do not think this needs any tests. I also don't think it needs a change note.
I also included a minor drive-by refactor. We were defining our own wrapper around
types.Unalias
when we don't need to (because it already has the property we want, i.e. being idempotent for non-alias types).