Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jez
Copy link
Collaborator

@jez jez commented Apr 7, 2022

Commit summary

  • Add a test that fails before these changes (da637be)

  • pre-work: Refactor Resolve::runIncremental into two explicit functions (e016114)

  • pre-work: ...WithoutStateMutation -> ...BestEffort (343d52a)

  • Immutable version of Packager::runIncremental (ad505ab)

    Honestly behaves like a hybrid of namer ("drop trees we don't want") and
    resolver ("use templates to do one thing or another conditionally").

Motivation

Honestly behaves like a hybrid of namer ("drop trees we don't want") and
resolver ("use templates to do one thing or another conditionally").

For posterity's sake, here are those two previous PRs: #5498, #5532.

Test plan

  • @jez This is not tested yet.

@jez jez requested a review from a team as a code owner April 7, 2022 03:56
@jez jez requested review from froydnj and removed request for a team April 7, 2022 03:56
@jez
Copy link
Collaborator Author

jez commented Apr 7, 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_LShtEgPKFz5fbf
https://go/builds/bui_LShtoXafxPwL2e

Copy link
Contributor

@froydnj froydnj left a comment

Choose a reason for hiding this comment

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

Nice catch, I keep forgetting about package magic.

Comment on lines 86 to 87
template <typename StateType>
static std::vector<ast::ParsedFile> runIncremental(StateType &gs, std::vector<ast::ParsedFile> files);
Copy link
Contributor

Choose a reason for hiding this comment

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

Slight preference for being explicit here with two different declarations of runIncremental and leaving the template magic in the .cc file: it's easier to catch mistakes in client code that way (e.g. the current state would happily accept you passing in a unique_ptr<GlobalState>...or a MutableCtx, which would normally auto-convert to GlobalState, but not here. you wouldn't see an error until link time).

(The proposed scheme here is also inconsistent with namer and resolver: the non-mutating versions of those have different names, whereas packager would not. I tend to think having identical names is not a good thing for what we're trying to do, even if C++ is happy to overload on const qualification.)

@jez jez force-pushed the jez-immutable-packager branch 2 times, most recently from 90d672b to b7e9e8b Compare April 7, 2022 23:45
@jez jez force-pushed the jez-immutable-packager branch from b7e9e8b to ad505ab Compare April 7, 2022 23:56
@jez jez enabled auto-merge (squash) April 7, 2022 23:58
@jez jez merged commit 9edf122 into master Apr 8, 2022
@jez jez deleted the jez-immutable-packager branch April 8, 2022 00:13
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.

3 participants