Skip to content

Fix deprecated warnings in Ruby 2.4.0+ - #36

Closed
koic wants to merge 1 commit into
halostatue:masterfrom
koic:integer_unification
Closed

koic wants to merge 1 commit into
halostatue:masterfrom
koic:integer_unification

Conversation

@koic

@koic koic commented Dec 1, 2016

Copy link
Copy Markdown

Ruby 2.4.0 unifies Fixnum and Bignum into Integer.

https://bugs.ruby-lang.org/issues/12005

Fix following deprecated warnings in Ruby 2.4.0-preview3.

warning: constant ::Fixnum is deprecated

Thanks.

Comment thread lib/diff/lcs/change.rb
raise "Invalid Change Action '#{@action}'"
end
raise "Invalid Position Type" unless @position.kind_of? Fixnum
raise "Invalid Position Type" unless @position.kind_of? Integer

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see this in the same way that I saw a different fix in minitest;

class Diff::LCS::Change
  IntClass = 1.class # :nodoc:

  
  raise "Invalid Position Type" unless @position.kind_of? IntClass
end

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. It seems to me that it is used when we want to change behavior in 2.4 and 2.3 or lower.
However, Object#kind_of? (NOT Object#instance_of?) has been used here. Therefore, I think that it is better to use Integer as it is. Integer is a super class of Fixnum, so I think that is simple here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @halostatue, could you reply for above @koic comment?
I really hope that this issue is fixed, and bumped (released), because this is one of the reason that cucumber is not supported on Ruby 2.4.

Thank you.

halostatue added a commit that referenced this pull request Jan 11, 2017
halostatue added a commit that referenced this pull request Jan 11, 2017
@halostatue halostatue mentioned this pull request Jan 11, 2017
halostatue added a commit that referenced this pull request Jan 11, 2017
- Updated testing and gem infrastructure.
- Cleaning up documentation.
- Modernizing specs.
- Silence Ruby 2.4 Fixnum deprecation warnings. Fixes #36, #38.
- Ensure test dependencies are loaded. Fixes #33, #34 so that specs can be run
  independently.
- Fix issue #1 with incorrect intuition of patch direction. Tentative fix, but
  the failure cases pass now.
@koic
koic deleted the integer_unification branch January 19, 2017 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants