marcandre / backports

The latest features of Ruby backported to older versions.
MIT License
436 stars 52 forks source link

Fix 2.5 Struct.new #148

Closed palkan closed 4 years ago

palkan commented 4 years ago

Kernel.eval accepts binding as the second argument and file and line as the latter two.

Found it while trying to use with 2.4:

$ ruby -v
ruby 2.4.10p364 (2020-03-31 revision 67879) [x86_64-linux]

$ ruby -rbackports/latest -e "p :ok"

/usr/local/bundle/gems/backports-3.17.1/lib/backports/2.5.0/struct/new.rb:3:in `eval': no implicit conversion of Integer into String (TypeError)
        from /usr/local/bundle/gems/backports-3.17.1/lib/backports/2.5.0/struct/new.rb:3:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/local/bundle/gems/backports-3.17.1/lib/backports/std_lib.rb:12:in `require_with_backports'
       ...
        from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:34:in `require'
marcandre commented 4 years ago

Oh wow, thanks... Now I've curious as to how come it didn't come up in my CI...

marcandre commented 4 years ago

My CI seems to be failing too so I'll have to investigate a bit.

marcandre commented 4 years ago

Turns out if running the specs ran into major issues my test suite considered that a success 💣 All fixed and released. Thanks a lot for the report