Skip to content

Commit

Permalink
- rename 2.8 to 3.0 everywhere (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
iliabylich committed Sep 1, 2020
1 parent 73b1945 commit a7da26c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion doc/AST_FORMAT.md
Expand Up @@ -1181,7 +1181,7 @@ Format if `emit_forward_arg` compatibility flag is disabled:
~~~~~ expression
~~~

However, Ruby 2.8 added support for leading arguments before `...`, and so
However, Ruby 3.0 added support for leading arguments before `...`, and so
it can't be used as a replacement of the `(args)` node anymore. To solve it
`emit_forward_arg` should be enabled.

Expand Down
2 changes: 1 addition & 1 deletion lib/parser/lexer.rl
Expand Up @@ -2030,7 +2030,7 @@ class Parser::Lexer

'...'
=> {
if @version >= 28
if @version >= 30
if @lambda_stack.any? && @lambda_stack.last + 1 == @paren_nest
# To reject `->(...)` like `->...`
emit(:tDOT3)
Expand Down
2 changes: 1 addition & 1 deletion parser.gemspec
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
lib/parser/ruby25.rb
lib/parser/ruby26.rb
lib/parser/ruby27.rb
lib/parser/ruby28.rb
lib/parser/ruby30.rb
lib/parser/macruby.rb
lib/parser/rubymotion.rb
)
Expand Down
2 changes: 1 addition & 1 deletion test/test_lexer.rb
Expand Up @@ -3568,7 +3568,7 @@ def test_ambiguous_integer_re
end

def test_endless_method
setup_lexer(28)
setup_lexer(30)

assert_scanned('def foo() = 42',
:kDEF, "def", [0, 3],
Expand Down
72 changes: 36 additions & 36 deletions test/test_parser.rb
Expand Up @@ -29,7 +29,7 @@ def parser_for_ruby_version(version)
SINCE_2_5 = SINCE_2_4 - %w(2.4)
SINCE_2_6 = SINCE_2_5 - %w(2.5)
SINCE_2_7 = SINCE_2_6 - %w(2.6)
SINCE_2_8 = SINCE_2_7 - %w(2.7)
SINCE_3_0 = SINCE_2_7 - %w(2.7)

# Guidelines for test naming:
# * Test structure follows structure of AST_FORMAT.md.
Expand Down Expand Up @@ -6587,7 +6587,7 @@ def test_context_def
%q{def m() = get_context},
%q{def m(a = get_context) = 42}
].each do |code|
assert_context([:def], code, SINCE_2_8)
assert_context([:def], code, SINCE_3_0)
end
end

Expand All @@ -6603,7 +6603,7 @@ def test_context_defs
%q{def foo.m() = get_context},
%q{def foo.m(a = get_context) = 42}
].each do |code|
assert_context([:defs], code, SINCE_2_8)
assert_context([:defs], code, SINCE_3_0)
end
end

Expand Down Expand Up @@ -7897,7 +7897,7 @@ def test_forward_args_invalid
[:error, :unexpected_token, { :token => 'tBDOT3' }],
%q{def foo(x,y,z); bar(x, y, z, ...); end},
%q{ ^^^ location},
SINCE_2_8)
SINCE_3_0)

assert_diagnoses(
[:error, :unexpected_token, { :token => 'tBDOT3' }],
Expand All @@ -7921,7 +7921,7 @@ def test_forward_args_invalid
[:error, :unexpected_token, { :token => 'tDOT3' }],
%q{->(...) {}},
%q{ ^^^ location},
SINCE_2_8)
SINCE_3_0)

# Here and below the parser asssumes that
# it can be a beginningless range, so the error comes after reducing right paren
Expand Down Expand Up @@ -7990,7 +7990,7 @@ def test_trailing_forward_arg
| ~~~~~~~~~~~ expression (args)
| ~ end (args)
| ~~~ expression (args.forward_arg)},
SINCE_2_8)
SINCE_3_0)
end


Expand Down Expand Up @@ -9588,7 +9588,7 @@ def test_endless_method
| ^ assignment
|! end
|~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:def, :inc,
Expand All @@ -9601,7 +9601,7 @@ def test_endless_method
| ~~~ name
| ^ assignment
|~~~~~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:defs, s(:send, nil, :obj), :foo,
Expand All @@ -9613,7 +9613,7 @@ def test_endless_method
| ~~~ name
| ^ assignment
|~~~~~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:defs, s(:send, nil, :obj), :inc,
Expand All @@ -9627,7 +9627,7 @@ def test_endless_method
| ^ operator
| ^ assignment
|~~~~~~~~~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)
end

def test_endless_method_forwarded_args_legacy
Expand All @@ -9642,7 +9642,7 @@ def test_endless_method_forwarded_args_legacy
| ~~~ name
| ^ assignment
|~~~~~~~~~~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)
Parser::Builders::Default.emit_forward_arg = true
end

Expand All @@ -9651,13 +9651,13 @@ def test_endless_method_without_brackets
[:error, :unexpected_token, { :token => 'tEQL' }],
%Q{def foo = 42},
%q{ ^ location},
SINCE_2_8)
SINCE_3_0)

assert_diagnoses(
[:error, :unexpected_token, { :token => 'tEQL' }],
%Q{def obj.foo = 42},
%q{ ^ location},
SINCE_2_8
SINCE_3_0
)
end

Expand All @@ -9671,7 +9671,7 @@ def test_endless_method_with_rescue_mod
s(:int, 2)), nil)),
%q{def m() = 1 rescue 2},
%q{},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:defs,
Expand All @@ -9683,7 +9683,7 @@ def test_endless_method_with_rescue_mod
s(:int, 2)), nil)),
%q{def self.m() = 1 rescue 2},
%q{},
SINCE_2_8)
SINCE_3_0)
end

def test_rasgn
Expand All @@ -9693,7 +9693,7 @@ def test_rasgn
%q{1 => a},
%q{~~~~~~ expression
| ^^ operator},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:rasgn,
Expand All @@ -9702,7 +9702,7 @@ def test_rasgn
%q{1 + 2 => $a},
%q{~~~~~~~~~~~ expression
| ^^ operator},
SINCE_2_8)
SINCE_3_0)
end

def test_mrasgn
Expand All @@ -9713,7 +9713,7 @@ def test_mrasgn
%q{13.divmod(5) => a,b},
%q{~~~~~~~~~~~~~~~~~~~ expression
| ^^ operator},
SINCE_2_8)
SINCE_3_0)

assert_parses(
s(:mrasgn,
Expand All @@ -9724,15 +9724,15 @@ def test_mrasgn
%q{13.divmod(5) => a,b => c, d},
%q{~~~~~~~~~~~~~~~~~~~ expression (mrasgn)
|~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression},
SINCE_2_8)
SINCE_3_0)
end

def test_rasgn_line_continuation
assert_diagnoses(
[:error, :unexpected_token, { :token => 'tASSOC' }],
%Q{13.divmod(5)\n=> a,b; [a, b]},
%{ ^^ location},
SINCE_2_8)
SINCE_3_0)
end

def test_find_pattern
Expand All @@ -9754,7 +9754,7 @@ def test_find_pattern
| ~ end (in_pattern.find_pattern)
| ~~ expression (in_pattern.find_pattern.match_rest/1)
| ~~ expression (in_pattern.find_pattern.match_rest/2)},
SINCE_2_8)
SINCE_3_0)

assert_parses_pattern_match(
s(:in_pattern,
Expand All @@ -9768,7 +9768,7 @@ def test_find_pattern
s(:true)),
%q{in String(*, 1, *) then true},
%q{ ~~~~~~~ expression (in_pattern.const_pattern.find_pattern)},
SINCE_2_8)
SINCE_3_0)

assert_parses_pattern_match(
s(:in_pattern,
Expand All @@ -9782,7 +9782,7 @@ def test_find_pattern
s(:true)),
%q{in Array[*, 1, *] then true},
%q{ ~~~~~~~ expression (in_pattern.const_pattern.find_pattern)},
SINCE_2_8)
SINCE_3_0)

assert_parses_pattern_match(
s(:in_pattern,
Expand All @@ -9794,7 +9794,7 @@ def test_find_pattern
s(:true)),
%q{in *, 42, * then true},
%q{ ~~~~~~~~ expression (in_pattern.find_pattern)},
SINCE_2_8)
SINCE_3_0)
end

def test_invalid_source
Expand All @@ -9807,7 +9807,7 @@ def test_invalid_source
end
end

def test_reserved_for_numparam__before_28
def test_reserved_for_numparam__before_30
assert_parses(
s(:block,
s(:send, nil, :proc),
Expand All @@ -9816,14 +9816,14 @@ def test_reserved_for_numparam__before_28
s(:nil))),
%q{proc {_1 = nil}},
%q{},
ALL_VERSIONS - SINCE_2_8)
ALL_VERSIONS - SINCE_3_0)

assert_parses(
s(:lvasgn, :_2,
s(:int, 1)),
%q{_2 = 1},
%q{},
ALL_VERSIONS - SINCE_2_8)
ALL_VERSIONS - SINCE_3_0)

assert_parses(
s(:block,
Expand All @@ -9833,46 +9833,46 @@ def test_reserved_for_numparam__before_28
s(:arg, :_3))), nil),
%q{proc {|_3|}},
%q{},
SINCE_1_9 - SINCE_2_8)
SINCE_1_9 - SINCE_3_0)

assert_parses(
s(:def, :x,
s(:args,
s(:arg, :_4)), nil),
%q{def x(_4) end},
%q{},
ALL_VERSIONS - SINCE_2_8)
ALL_VERSIONS - SINCE_3_0)

assert_parses(
s(:def, :_5,
s(:args), nil),
%q{def _5; end},
%q{},
ALL_VERSIONS - SINCE_2_8)
ALL_VERSIONS - SINCE_3_0)

assert_parses(
s(:defs,
s(:self), :_6,
s(:args), nil),
%q{def self._6; end},
%q{},
ALL_VERSIONS - SINCE_2_8)
ALL_VERSIONS - SINCE_3_0)
end

def test_reserved_for_numparam__since_28
def test_reserved_for_numparam__since_30
# Regular assignments:

assert_diagnoses(
[:error, :reserved_for_numparam, { :name => '_1' }],
%q{proc {_1 = nil}},
%q{ ^^ location},
SINCE_2_8)
SINCE_3_0)

assert_diagnoses(
[:error, :reserved_for_numparam, { :name => '_2' }],
%q{_2 = 1},
%q{^^ location},
SINCE_2_8)
SINCE_3_0)

# Arguments:

Expand Down Expand Up @@ -9941,7 +9941,7 @@ def test_reserved_for_numparam__since_28
[:error, :reserved_for_numparam, { :name => '_3' }],
code,
location,
SINCE_2_8)
SINCE_3_0)
end

# Method definitions:
Expand Down Expand Up @@ -9972,7 +9972,7 @@ def test_reserved_for_numparam__since_28
[:error, :reserved_for_numparam, { :name => '_5' }],
code,
location,
SINCE_2_8)
SINCE_3_0)
end
end
end

0 comments on commit a7da26c

Please sign in to comment.