8000 Flatten virtual package module into a series of casgns by aadi-stripe · Pull Request #5599 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Flatten virtual package module into a series of casgns #5599

< 8000 summary id="button-5c380a426713e6cc" class="btn btn-sm btn-primary m-0 ml-0 ml-md-2" > 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 3 commits into from
Apr 18, 2022

Conversation

aadi-stripe
Copy link
Collaborator
@aadi-stripe aadi-stripe commented Apr 7, 2022

Changes the structure of the AST rewrite that is performed by the packager. Essentially, we remove all intermediate module declarations and replace them with fully-qualified casgns.

For details, see: before and after

Motivation

--stripe-packages mode currently works poorly when a package namespace also corresponds to a class in the actual codebase (as opposed to a module). Essentially, it breaks when a nested-package is imported by a parent package that is also a class. Therefore, we replace module declarations with fully qualified casgns -- that way we do not redeclare any modules.

As a side effect, this change also leads to a ~12% memory improvement in type-checking the Stripe codebase.

Runtime changes perhaps not statistically significant.
BEFORE
before_casgn_1
before_casgn_2
before_casgn_3

AFTER
after_casgn_1
after_casgn_2
after_casgn_3

Test plan

See included automated tests.
Tested on Stripe codebase.

@aadi-stripe aadi-stripe requested a review from a team as a code owner April 7, 2022 14:51
@aadi-stripe aadi-stripe requested review from elliottt and removed request for a team April 7, 2022 14:51
@aadi-stripe aadi-stripe marked this pull request as draft April 7, 2022 14:51
@elliottt elliottt removed their request for review April 7, 2022 16:16
@froydnj
Copy link
Contributor
froydnj commented Apr 12, 2022

We have a policy of testing changes to Sorbet against Stripe's codebase before
merging them. I've kicked off a test run for the current PR. When the build
finishes, I'll share with you whether or how it failed. Thanks!

Stripe employees can see the build results here:

https://go/builds/bui_LUmxBerksMB8br
https://go/builds/bui_LUmxQ2lrlSZzrj

@elliottt
Copy link
Collaborator

Stripe issues should be resolved as of https://go/ps/pull/444402

@aadi-stripe aadi-stripe force-pushed the aadi-flat-pkg-module branch from 95fe893 to 188b129 Compare April 17, 2022 03:18
@aadi-stripe
Copy link
Collaborator Author

We have a policy of testing changes to Sorbet against Stripe's codebase before
merging them. I've kicked off a test run for the current PR. When the build
finishes, I'll share with you whether or how it failed. Thanks!

Stripe employees can see the build results here:

https://go/builds/bui_LWRa0u9YrXig6L
https://go/builds/bui_LWRamYoNvxw6gR

@aadi-stripe aadi-stripe changed the title [wip] Flatten virtual package module into a series of casgns Flatten virtual package module into a series of casgns Apr 17, 2022
@aadi-stripe aadi-stripe marked this pull request as ready for review April 17, 2022 16:58
Copy link
Contributor
@nroman-stripe nroman-stripe left a comment
9B7E

Choose a reason for hiding this comment

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

lgtm

@aadi-stripe aadi-stripe merged commit c7df2c9 into master Apr 18, 2022
@aadi-stripe aadi-stripe deleted the aadi-flat-pkg-module branch April 18, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0