-
Notifications
You must be signed in to change notification settings - Fork 7
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
Introduce Type
builder interface
#331
Conversation
049dd0c
to
3dac103
Compare
This interface is used to manually build RBI types. Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a couple of comments.
@@ -586,7 +586,7 @@ def add_block_param(name) | |||
end | |||
def add_sig( | |||
params: [], | |||
return_type: nil, | |||
return_type: "void", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also be Type.void
like below?
@@ -839,7 +839,7 @@ def visit_call_node(node) | |||
end | |||
end | |||
when "void" | |||
@current.return_type = nil | |||
@current.return_type = "void" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, maybe this should be Type.void
? Or do want to wait for the Type parser to make that change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I should have changed all of them to "void"
for now
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
This interface let the user create RBI types manually:
On top of providing more safety with static typing, the interface will apply some sanity rules to what the user builds to avoid common mistakes when generating RBIs:
The interface will also take care of simplifying some unnecessary complex types:
This PR changes the
Model
classes to allow passing either Strings or Types to relevant classes such asSig
,SigParam
orTStruct
.cc. @paracycle