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
base: main
Are you sure you want to change the base?
Swift: extract types for patterns #14570
Conversation
There was a problem hiding this 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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 .
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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 you need to. I definitely don't consider myself an expert though.
swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
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).
Very much agree! |
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
|
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 think the |
There was a problem hiding this 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.
No description provided.