Aliasing `.new` doesn't reuse the signature from `#initialize`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with Tapioca's RBI generation path for Ruby singleton method aliases, using the Money example and its generated .rbi as the reproduction. Compare the alias from_cents with initialize and check the missing source:// pointer; done means the alias reuses the initializer signature and includes the expected source pointer.
Written by the indexing model from the issue text.
Description
I'm running into this with the money gem:
# .rb
class Money
class << self
alias_method :from_cents, :new
end
def initialize( obj, currency = Money.default_currency, options = {})
# ...
end
end
# generated .rbi
class Money
# source://money//lib/money/money.rb#341
def initialize(obj, currency = T.unsafe(nil), options = T.unsafe(nil)); end
class << self
def from_cents(*_arg0); end
end
end
Also note that no source:// pointer comment is generated for the .new alias.
I get that technically you could override both .new and #initialize to have different signatures, but I'd be surprised if that's a common pattern. AFAICT Sorbet uses #initialize's signature to validate calls to .new.
- 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 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/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 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·