Skip to content

Go: Make DataFlowType a singleton #11697

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

Merged
merged 2 commits into from
Dec 15, 2022

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Dec 14, 2022

All test result changes are due to no longer printing the type of each data flow node. I have added comments in two places where this causes one less line, because two lines become identical.

@github-actions github-actions bot added the Go label Dec 14, 2022
| InsecureHostKeyCallbackExample.go:32:3:34:3 | function literal : signature type | InsecureHostKeyCallbackExample.go:31:14:34:4 | type conversion : signature type |
| InsecureHostKeyCallbackExample.go:45:3:47:3 | function literal : signature type | InsecureHostKeyCallbackExample.go:52:20:52:48 | type conversion |
| InsecureHostKeyCallbackExample.go:58:39:58:46 | definition of callback : HostKeyCallback | InsecureHostKeyCallbackExample.go:62:20:62:27 | callback |
| InsecureHostKeyCallbackExample.go:58:39:58:46 | definition of callback : signature type | InsecureHostKeyCallbackExample.go:62:20:62:27 | callback |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: the above two lines become one line because they are the same when the type is removed.

| InsecureHostKeyCallbackExample.go:52:20:52:48 | type conversion | semmle.label | type conversion |
| InsecureHostKeyCallbackExample.go:58:39:58:46 | definition of callback : HostKeyCallback | semmle.label | definition of callback : HostKeyCallback |
| InsecureHostKeyCallbackExample.go:58:39:58:46 | definition of callback : signature type | semmle.label | definition of callback : signature type |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: the above two lines become one line because they are the same when the type is removed.

@owen-mc owen-mc marked this pull request as ready for review December 14, 2022 16:03
@owen-mc owen-mc requested a review from a team as a code owner December 14, 2022 16:03
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Dec 14, 2022
class DataFlowType = Type;
private newtype TDataFlowType =
TTodoDataFlowType() or
TTodoDataFlowType2() // Add a dummy value to prevent bad functionality-induced joins arising from a type of size 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

I note only some other languages do this -- might as well avoid the hack if not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those languages did need it though. I assume it wouldn't be hard to remove our hack when the other hacks are removed, if it isn't needed any more. Are you suggesting that I omit the second branch, run a performance check to see if we can get by without it, and if so then omit it and hope that we don't hit the performance problem in future?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically yes, though I wouldn't object to the flow merge as-is (after the requested double-check below), then experimentally remove the hack from all languages.

Suggest also querying on slack whether the comment about singleton types still applies or has perhaps been fixed since.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Otherwise looks good -- please script up checking the diffs are just disappearing types (suggested mechanism: hack AccessPath.toString to omit the : typeDescription suffix; run tests in --learn mode; then run again with your branch checked out. Expected result: a small number of nodes merging as you have already observed; no other changes.

@owen-mc
Copy link
Contributor Author

owen-mc commented Dec 15, 2022

I have done the check that you requested, and the results were as you expected.

@owen-mc owen-mc merged commit 0af5300 into github:main Dec 15, 2022
@owen-mc owen-mc deleted the go/make-dataflowtype-singleton branch December 15, 2022 12:08
@owen-mc owen-mc changed the title Make DataFlowType a singleton Go: Make DataFlowType a singleton Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants