palkan/anyway_config

Upcoming deprecation warning for 3.4

Closed this issue · 4 comments

What did you do?

Ran bundle exec bootsnap precompile --gemfile app/ lib/.

What did you expect to happen?

No warnings to be printed.

What actually happened?

The following warnings were printed:

#44 1.123 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/auto_cast.rb:16: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.123 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/auto_cast.rb:18: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.124 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/tracing.rb:32: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.124 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/tracing.rb:87: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.125 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/type_casting.rb:37: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.128 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/config.rb:157: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it
#44 1.128 /usr/local/bundle/gems/anyway_config-2.6.2/lib/anyway/config.rb:383: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4; use it() or self.it

Additional context

Environment

Ruby Version: 3.3

Framework Version (Rails, whatever): 7.1.2

Anyway Config Version: 2.6.2

The bootsnap precompile command tries to precompile all Ruby files under the gem lib/ folders, even those not matching your Ruby version (and, thus, not used in production). We cannot fix this at our end (and should not, since there is no issue or bug). The only workaround is to exclude these files from precompilation:

bundle exec bootsnap precompile --gemfile --exclude 'anyway/tracing|anyway/auto_cast|anyway/type_casting|anyway/config|' app/ lib/

# or simpler (not a big deal excluding a small library)
bundle exec bootsnap precompile --gemfile --exclude 'anyway/' app/ lib/

Doesn't this imply an upcoming breaking change in this gem for 3.4 though?

Edit: I guess if the expected behavior is that "calls without arguments [should] refer to the first block param" for these lines of code then there is no breaking change.

"calls without arguments [should] refer to the first block param" for these lines of code then there is no breaking change.

Yep, correct. We use it intentionally as the first argument; so, in Ruby 3.4 the original source files would be used (right now the transpiled ones are loaded).

Gotchu, thanks!