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

Swift: extract types for patterns #14570

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

rdmarsh2
Copy link
Contributor

No description provided.

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner October 23, 2023 18:28
@github-actions github-actions bot added the Swift label Oct 23, 2023
Copy link
Contributor

@AlexDenisov AlexDenisov left a comment

Choose a reason for hiding this comment

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

I'm not sure about the upgrade script, but overall LGTM.
Happy to approve once the formatting is fixed.

<dbstats>
<typesizes />
<stats />
</dbstats>
Copy link
Contributor

Choose a reason for hiding this comment

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

We didn't put stats in any other upgrade scripts, do we need this now?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we do, no.


from Element p, Element t
where none()
select p, t
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this script do? Is it simple removing all the elements?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think delete in the upgrade.properties does this, see https://github.com/github/codeql/blob/main/docs/prepare-db-upgrade.md .

Copy link
Contributor

Choose a reason for hiding this comment

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

... but that's what you've done in the downgrade script. Are we just trying to synthesize an empty table here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just synthesizing an empty table right now. Is there a better way to do that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure you need to. I definitely don't consider myself an expert though.

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Results look good as far as I can see.

It would be good to understand the motivation for this and whether this change meets that need. I can certainly imagine these types being useful.

I also think we should have a DCA run on this.

@MathiasVP
Copy link
Contributor

MathiasVP commented Oct 24, 2023

It would be good to understand the motivation for this and whether this change meets that need. I can certainly imagine these types being useful.

The motivation for this is for type pruning, where we need to assign a meaningful type for dataflow nodes. Some time ago I talked to Robert about what we should do for the dataflow nodes representing patterns, and we agreed that we could probably assign it some notion of a Top type, but it looks like we might as well grab the real type off the patterns (which is what Robert is extracting here).

I also think we should have a DCA run on this.

Very much agree!

rdmarsh2 and others added 2 commits October 25, 2023 14:19
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
@rdmarsh2
Copy link
Contributor Author

DCA looks clean, only thing left is that question about the upgrade script - @AlexDenisov is there a better way to synthesize an empty table?

@AlexDenisov
Copy link
Contributor

AlexDenisov commented Oct 27, 2023

DCA looks clean, only thing left is that question about the upgrade script - @AlexDenisov is there a better way to synthesize an empty table?

I don't know, and I also don't know why we'd need to synthesize a new table 😅
I'm very far from being knowledgeable about the upgrade scripts.

@geoffw0
Copy link
Contributor

geoffw0 commented Oct 27, 2023

I think the .dbscheme defines what tables exist, the upgrade .ql scripts only need to populate the right rows in them. So to create an empty table no upgrade .ql script is required. Perhaps get confirmation from someone who works on upgrade scripts more often (maybe from the CPP side) or failing that the foundations team.

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

To be clear, the upgrade itself is still required (to mark the change in .dbscheme), I just don't think it needs to run any .ql script inside if we want the new table empty.

Terminology is confusing.

Other than that question, this LGTM as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants