-
Notifications
You must be signed in to change notification settings - Fork 52
Set up typechecking for DSL blocks #419
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # typed: false | ||
| # typed: true | ||
| # frozen_string_literal: true | ||
|
|
||
| module Roast | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # typed: false | ||
| # typed: true | ||
| # frozen_string_literal: true | ||
|
|
||
| module Roast | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # typed: true | ||
| # frozen_string_literal: true | ||
|
|
||
| module Roast | ||
| module DSL | ||
| class ConfigContext | ||
| #: (?Symbol?) {() [self: Roast::DSL::Cogs::Cmd::Config] -> void} -> void | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handwriting RBIs is a stopgap - I'll investigate doing this via a Tapioca compiler next, which will also give the same benefits to third party cogs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree it makes sense to get it working first in a bare-bones way before investing in automation |
||
| def cmd(name = nil, &block); end | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # typed: true | ||
| # frozen_string_literal: true | ||
|
|
||
| module Roast | ||
| module DSL | ||
| class ExecutionContext | ||
| #: (?Symbol?) {() [self: Roast::DSL::Cogs::Cmd] -> String} -> void | ||
| def cmd(name = nil, &block); end | ||
| end | ||
| end | ||
| end |
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.
This RBS type is what allows us to transparently rebind the self of the config and execute blocks.
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.
I love this