Skip to content
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

Go: Make the models-as-data subtypes column do something more sensible for promoted methods #17618

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

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Sep 30, 2024

Not ready for review yet. I think I've fixed all the spurious test results. I'm going to run DCA to see how this affects alerts.

To do:

  • Remove debugging code
  • Add tests for multiple layers of embedded and multiple layers of implicit field reads.
  • Move predicates looking through implicit field reads to method read node?

@github-actions github-actions bot added the Go label Sep 30, 2024
subtypes = true and
// p.type is an interface and we include types which implement it
exists(Method m2, string pkg2, string type2 |
subtypes = true and

Check warning

Code scanning / CodeQL

Redundant assignment. Warning

The variable subtypes
has previously been assigned
the same value
.
cn = this.asCall().getNode() and
result.asEntity() = cn.getTarget() and
// result.asEntity().getName() = "Source" and
cn = this.asCall().getNode() and

Check warning

Code scanning / CodeQL

Redundant assignment. Warning

The variable cn
has previously been assigned
the same value
.
* field at depth `fieldDepth` which is on the chain of embedded fields which
* leads to `m` being promoted, and the type of the field is `pkg.name`.
*/
private predicate receiverInfoHelper(

Check warning

Code scanning / CodeQL

Missing QLDoc for parameter Warning

The QLDoc has no documentation for embeddedParent, but the QLDoc mentions fieldDepth, and methodDepth
Comment on lines +325 to +335
depth = 1 and
embeddedParent = st.getOwnField(_, true) and
embeddedParent.getType().hasQualifiedName(pkg, name)
or
depth > 1 and
exists(Type embeddedType, StructType st2 |
st.hasOwnField(_, _, embeddedType, true) and
st2 = embeddedType.getUnderlyingType() and
m = st2.getMethodOfEmbedded(embeddedParent, _, depth - 1) and
receiverInfoHelper(m, embeddedParent, st2, depth - 1, pkg, name)
)

Check warning

Code scanning / CodeQL

Var only used in one side of disjunct. Warning

The
variable m
is only used in one side of disjunct.
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.

1 participant