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 protobuf compiler default field values #1543

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

paracycle
Copy link
Member

Motivation

There is no point in trying to construct elaborate default values for the initializer fields, since in the RBI file, the default value is meaningless. What matters is the type of the field and if the field is optional or not. Thus, we can easily simplify the code and generate default values as T.unsafe(nil).

Implementation

Change default values to T.unsafe(nil).

Tests

Updated existing tests.

The no point in trying to construct elaborate default values for
the initializer fields, since in the RBI file, the default value is meaningless. What matters is the type of the field and if the field is optional or not. Thus, we can easily simplify the code and generate default values as `T.unsafe(nil)`.
@paracycle paracycle added the enhancement New feature or request label Jun 23, 2023
@paracycle paracycle requested a review from a team as a code owner June 23, 2023 18:04
@paracycle paracycle requested a review from egiurleo June 23, 2023 18:04
@paracycle paracycle merged commit 40d89a2 into main Jun 23, 2023
@paracycle paracycle deleted the uk-fix-protobuf-defaults branch June 23, 2023 20:49
@shopify-shipit shopify-shipit bot temporarily deployed to production July 12, 2023 18:26 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants