`tapioca gem`: a method with an anonymous block + RBS-comment: compiled to invalid syntax
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with the reproduction in spec/tapioca/gem/pipeline_spec.rb, especially the test for compiling an RBS signature on a method with an anonymous block. Trace how the signature is compiled and how the RBI method parameters are generated. Done means the compile test reports no unhandled errors and generated RBI contains valid syntax with a proc block parameter, such as &block.
Written by the indexing model from the issue text.
Description
If we add a test compiling the following code (to spec/tapioca/gem/pipeline_spec.rb):
class Foo
#: { -> void } -> void
def foo(&); end
end
the test will fail with
Tapioca::Gem::PipelineSpec::Tapioca::Gem::Pipeline
it compiles RBS signature for a method with ananymous block FAIL (0.36s)
Tapioca::Gem::Pipeline#compile should not have any unhandled errors reported.
Please either fix your changes to ensure no errors are reported, or explicity pass
in a custom `error_handler: ->(err) { ... }` to the `compile()` method to handle
expected errors.
.
Expected ["Unable to compile signature for method: Foo#foo\n Exception raised when loading signature: #<RuntimeError: The declaration for `foo` is missing parameter(s): &>\n"] to be empty.
spec/tapioca/gem/pipeline_spec.rb:61:in 'Tapioca::Gem::PipelineSpec#compile'
spec/tapioca/gem/pipeline_spec.rb:4907:in 'block (2 levels) in <class:PipelineSpec>'
Finished in 0.39466s
1 tests, 2 assertions, 1 failures, 0 errors, 0 skips
Buf if we try to generate an RBI-file for a gem with such method, we get a definition with invalid syntax, like
sig { params(_arg0: ).returns(T.untyped) }
def foo(&_arg0); end
Expected result signatures:
sig { params("&": T.proc.void).void }
def foo(&); end
or
sig { params(block: T.proc.void).void }
def foo(&block); end
- Dominant language
- Ruby
- Stars
- 873
- Forks
- 164
- Avg merge
- 4d 27m
- Merged PRs (30d)
- 9
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/tapioca
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
help-wanted
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100