Project

General

Profile

Actions

Bug #16438

closed

Check warning messages for Ruby 2.7

Added by ko1 (Koichi Sasada) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Target version:
[ruby-core:96358]

Description

Please check Ruby 2.7 new introduced warning messages.

  • deprecation warning
def foo(**kw)
end

foo({}) #=> test.rb:4: warning: The last argument is used as the keyword parameter
        #   test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?
# deafult: on
_1 = 2
#=>
# t.rb:1: warning: `_1' is used as numbered parameter

# default: on
def _1; end
#=> test.rb:1: warning: `_1' is used as numbered parameter

# deafult: on
# added at Today!!
def foo
  proc.call #=> 1
end

foo{p 1}
#=>
# t.rb:2: warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
# 1

# default: on
$; = //
#=> t.rb:1: warning: non-nil $; will be deprecated

$, = ''
#=> t.rb:2: warning: non-nil $, will be deprecated

# default: on
   def foo
     class << Object.new
       yield
     end
   end
   foo { p :ok } #=> warning: `yield' in class syntax will not be supported from Ruby 3.0.

# default: on
require 'open-uri'
open('http://atdot.net')
#=> test.rb:2: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open

# default: on
  • experimental feature
$ ./miniruby -e 'case 1; in 1; end'
-e:1: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!

# default: on
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0