-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add signatures for Gem::Version #610
Conversation
interface _HashLike[K, V] | ||
def each_pair: () { ([ K, V ]) -> untyped } -> self | ||
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.
[note] According to this advice: #605 (comment)
|
||
# True if the `version` string matches RubyGems' requirements. | ||
# | ||
def self.correct?: (_ToS version) -> bool |
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.
[note] It seems that nil
should not be received because of the deprecation below:
$ ruby -e 'Gem::Version.correct?(nil)'
nil versions are discouraged and will be deprecated in Rubygems 4
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.
Ah! _ToS
cannot reject nil
...
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.
Oh, I missed it… 😓
I want to improve this, but can we do it? (If we can, I will create a new PR)
It's not so bad as-is, though. 😅
# Load custom marshal format. It's a string for backwards (RubyGems 1.3.5 and | ||
# earlier) compatibility. | ||
# | ||
def marshal_load: (Array[String] array) -> 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.
[note] #marshal_load
returns nil
actually, but I think it should return void
because #marshal_load
calls internally #initialize
:
https://github.com/rubygems/rubygems/blob/v3.2.11/lib/rubygems/version.rb#L273-L275
This change adds signatures for the `Gem::Version` class. Follow-up of PR #605 See also: - https://github.com/rubygems/rubygems/blob/v3.2.11/lib/rubygems/version.rb - https://ruby-doc.org/stdlib-3.0.0/libdoc/rubygems/rdoc/Gem/Version.html
I guess we can remove Lines 5 to 18 in 448b67a
The polyfill is for type checking for RBS itself. you can try using it with Steep and ./steep/Gemfile .
|
@pocke Thanks for the comment. Should we add target :lib do
signature "sig"
+ signature "stdlib/rubygems"
check "lib"
ignore "lib/rbs/parser.rb" Because the published version of Lines 28 to 29 in 448b67a
|
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.
💎
The `Gem::Version` signature has been added with PR #610. I think we now can remove the polyfill of `Gem::Version`. Follow-up of <#610 (comment)>
This change adds signatures for the
Gem::Version
class.Follow-up of PR #605
See also: