-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Improve #to_str
and #to_json
for Version::NULL
.
#15403
Improve #to_str
and #to_json
for Version::NULL
.
#15403
Conversation
|
||
sig { returns(String) } | ||
def to_str | ||
raise NoMethodError, "undefined method `to_str' for #{self.class}:NULL" if null? |
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 is kinda hacky, would probably make more sense to deprecate Version#to_str
instead.
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.
Sounds tricky to deprecate given implicit conversions - can't really search to see what does that and there's likely cases in formulae (which we only run full CI on when we touch them). And all over place really for stuff like: Pathname("...")/version
But doing what you're doing here for NULL
does seem worthwhile to stop any subtle bugs.
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.
For the Pathname("...")/version
case we could actually implement Version#to_path
instead.
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.
Isn't exactly much of an improvement over to_str
though.
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.
Sounds tricky to deprecate given implicit conversions
Agreed 👍🏻
7e73196
to
e081a42
Compare
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.
Thanks @reitermarkus!
|
||
sig { returns(String) } | ||
def to_str | ||
raise NoMethodError, "undefined method `to_str' for #{self.class}:NULL" if null? |
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.
Sounds tricky to deprecate given implicit conversions
Agreed 👍🏻
e081a42
to
5c9c089
Compare
@reitermarkus For some reason this commit seems to be causing a weird CI failure on Linux (at Homebrew/homebrew-core#135761), or so
And I'm unable to debug the exact cause of this. Do you think you could look into this or point me to a fix? |
Technically it's a compatibility break yeah. Though it's hard to deprecate the old behaviour and we seem to have survived a few weeks without many noticing. We perhaps could have a special |
Ah alright. I thought it should be fixed in |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Mentioned this here: #15402 (comment)