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

Simplify Get implementation post deprecations. #10178

Merged
merged 1 commit into from Jun 26, 2020

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Jun 26, 2020

Problem

After the removal of deprecated Get syntax there were some other simplifications available for the implementation.

Solution

Remove a few levels of indirection in Get construction. In particular: the SubjectDeclaredType is always equal to Type[SubjectType], and so doesn't need a separate type variable. Additionally, the GetMaker and GetFactory classes could be inlined into Get's constructor.

Result

Simpler implementation, equivalent API and typecheckability.

[ci skip-jvm-tests]

[ci skip-jvm-tests]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks for simplifying!

"""Allow a Get to be `await`ed within an `async` method, returning a strongly-typed result.
+ Short form
a. Get(<ProductType>, <SubjectType>(<constructor args for subject>))
b. Get[<ProductType>](<SubjectType>(<constructor args for subject>))
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer valid.

subject: _SubjectType
+ Long form:
a. Get(<ProductType>, <SubjectType>, subject)
b. Get[<ProductType>](<SubjectType>, subject)
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer valid.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Mm: will fix in a followup.

@stuhood stuhood merged commit 41f4bfc into pantsbuild:master Jun 26, 2020
@stuhood stuhood deleted the stuhood/simplify-get-impl branch June 26, 2020 21:51
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.

None yet

2 participants