Skip to content

Commit 6f4e9ff

Browse files
committed
Move the post required parameters after the rest parameter
* See #1436
1 parent 63eda4c commit 6f4e9ff

File tree

180 files changed

+433
-433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+433
-433
lines changed

config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,11 +1908,11 @@ nodes:
19081908
type: node[]
19091909
- name: optionals
19101910
type: node[]
1911-
- name: posts
1912-
type: node[]
19131911
- name: rest
19141912
type: node?
19151913
kind: RestParameterNode
1914+
- name: posts
1915+
type: node[]
19161916
- name: keywords
19171917
type: node[]
19181918
- name: keyword_rest

test/yarp/errors_test.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def test_bad_arguments
494494
RequiredParameterNode(:@a),
495495
RequiredParameterNode(:$A),
496496
RequiredParameterNode(:@@a),
497-
], [], [], nil, [], nil, nil),
497+
], [], nil, [], [], nil, nil),
498498
nil,
499499
[:A, :@a, :$A, :@@a],
500500
Location(),
@@ -560,9 +560,9 @@ def test_do_not_allow_trailing_commas_in_method_parameters
560560
ParametersNode(
561561
[RequiredParameterNode(:a), RequiredParameterNode(:b), RequiredParameterNode(:c)],
562562
[],
563-
[],
564563
nil,
565564
[],
565+
[],
566566
nil,
567567
nil
568568
),
@@ -588,7 +588,7 @@ def test_do_not_allow_trailing_commas_in_lambda_parameters
588588
Location(),
589589
Location(),
590590
BlockParametersNode(
591-
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], nil, [], nil, nil),
591+
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], nil, [], [], nil, nil),
592592
[],
593593
Location(),
594594
Location()
@@ -644,8 +644,8 @@ def test_method_parameters_after_block
644644
ParametersNode(
645645
[],
646646
[],
647-
[RequiredParameterNode(:a)],
648647
nil,
648+
[RequiredParameterNode(:a)],
649649
[],
650650
nil,
651651
BlockParameterNode(:block, Location(), Location())
@@ -669,7 +669,7 @@ def test_method_with_arguments_after_anonymous_block
669669
:foo,
670670
Location(),
671671
nil,
672-
ParametersNode([], [], [RequiredParameterNode(:a)], nil, [], nil, BlockParameterNode(nil, nil, Location())),
672+
ParametersNode([], [], nil, [RequiredParameterNode(:a)], [], nil, BlockParameterNode(nil, nil, Location())),
673673
nil,
674674
[:&, :a],
675675
Location(),
@@ -693,8 +693,8 @@ def test_method_parameters_after_arguments_forwarding
693693
ParametersNode(
694694
[],
695695
[],
696-
[RequiredParameterNode(:a)],
697696
nil,
697+
[RequiredParameterNode(:a)],
698698
[],
699699
ForwardingParameterNode(),
700700
nil
@@ -721,8 +721,8 @@ def test_keywords_parameters_before_required_parameters
721721
ParametersNode(
722722
[],
723723
[],
724-
[RequiredParameterNode(:a)],
725724
nil,
725+
[RequiredParameterNode(:a)],
726726
[KeywordParameterNode(:b, Location(), nil)],
727727
nil,
728728
nil
@@ -747,10 +747,10 @@ def test_rest_keywords_parameters_before_required_parameters
747747
Location(),
748748
nil,
749749
ParametersNode(
750-
[],
751750
[],
752751
[],
753752
nil,
753+
[],
754754
[KeywordParameterNode(:b, Location(), nil)],
755755
KeywordRestParameterNode(:rest, Location(), Location()),
756756
nil
@@ -775,7 +775,7 @@ def test_double_arguments_forwarding
775775
:foo,
776776
Location(),
777777
nil,
778-
ParametersNode([], [], [], nil, [], ForwardingParameterNode(), nil),
778+
ParametersNode([], [], nil, [], [], ForwardingParameterNode(), nil),
779779
nil,
780780
[:"..."],
781781
Location(),
@@ -799,8 +799,8 @@ def test_multiple_error_in_parameters_order
799799
ParametersNode(
800800
[],
801801
[],
802-
[RequiredParameterNode(:a)],
803802
nil,
803+
[RequiredParameterNode(:a)],
804804
[KeywordParameterNode(:b, Location(), nil)],
805805
KeywordRestParameterNode(:args, Location(), Location()),
806806
nil
@@ -829,8 +829,8 @@ def test_switching_to_optional_arguments_twice
829829
ParametersNode(
830830
[],
831831
[],
832-
[RequiredParameterNode(:a)],
833832
nil,
833+
[RequiredParameterNode(:a)],
834834
[KeywordParameterNode(:b, Location(), nil)],
835835
KeywordRestParameterNode(:args, Location(), Location()),
836836
nil
@@ -859,8 +859,8 @@ def test_switching_to_named_arguments_twice
859859
ParametersNode(
860860
[],
861861
[],
862-
[RequiredParameterNode(:a)],
863862
nil,
863+
[RequiredParameterNode(:a)],
864864
[KeywordParameterNode(:b, Location(), nil)],
865865
KeywordRestParameterNode(:args, Location(), Location()),
866866
nil
@@ -892,8 +892,8 @@ def test_returning_to_optional_parameters_multiple_times
892892
OptionalParameterNode(:b, Location(), Location(), IntegerNode(IntegerBaseFlags::DECIMAL)),
893893
OptionalParameterNode(:d, Location(), Location(), IntegerNode(IntegerBaseFlags::DECIMAL))
894894
],
895-
[RequiredParameterNode(:c), RequiredParameterNode(:e)],
896895
nil,
896+
[RequiredParameterNode(:c), RequiredParameterNode(:e)],
897897
[],
898898
nil,
899899
nil
@@ -954,7 +954,7 @@ def test_do_not_allow_forward_arguments_in_lambda_literals
954954
Location(),
955955
Location(),
956956
Location(),
957-
BlockParametersNode(ParametersNode([], [], [], nil, [], ForwardingParameterNode(), nil), [], Location(), Location()),
957+
BlockParametersNode(ParametersNode([], [], nil, [], [], ForwardingParameterNode(), nil), [], Location(), Location()),
958958
nil
959959
)
960960

@@ -973,7 +973,7 @@ def test_do_not_allow_forward_arguments_in_blocks
973973
nil,
974974
BlockNode(
975975
[:"..."],
976-
BlockParametersNode(ParametersNode([], [], [], nil, [], ForwardingParameterNode(), nil), [], Location(), Location()),
976+
BlockParametersNode(ParametersNode([], [], nil, [], [], ForwardingParameterNode(), nil), [], Location(), Location()),
977977
nil,
978978
Location(),
979979
Location()
@@ -1046,7 +1046,7 @@ def test_duplicated_parameter_names
10461046
:foo,
10471047
Location(),
10481048
nil,
1049-
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b), RequiredParameterNode(:a)], [], [], nil, [], nil, nil),
1049+
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b), RequiredParameterNode(:a)], [], nil, [], [], nil, nil),
10501050
nil,
10511051
[:a, :b],
10521052
Location(),
@@ -1066,7 +1066,7 @@ def test_duplicated_parameter_names
10661066
:foo,
10671067
Location(),
10681068
nil,
1069-
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], RestParameterNode(:a, Location(), Location()), [], nil, nil),
1069+
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], RestParameterNode(:a, Location(), Location()), [], [], nil, nil),
10701070
nil,
10711071
[:a, :b],
10721072
Location(),
@@ -1085,7 +1085,7 @@ def test_duplicated_parameter_names
10851085
:foo,
10861086
Location(),
10871087
nil,
1088-
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], nil, [], KeywordRestParameterNode(:a, Location(), Location()), nil),
1088+
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], nil, [], [], KeywordRestParameterNode(:a, Location(), Location()), nil),
10891089
nil,
10901090
[:a, :b],
10911091
Location(),
@@ -1104,7 +1104,7 @@ def test_duplicated_parameter_names
11041104
:foo,
11051105
Location(),
11061106
nil,
1107-
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], [], nil, [], nil, BlockParameterNode(:a, Location(), Location())),
1107+
ParametersNode([RequiredParameterNode(:a), RequiredParameterNode(:b)], [], nil, [], [], nil, BlockParameterNode(:a, Location(), Location())),
11081108
nil,
11091109
[:a, :b],
11101110
Location(),
@@ -1123,7 +1123,7 @@ def test_duplicated_parameter_names
11231123
:foo,
11241124
Location(),
11251125
nil,
1126-
ParametersNode([], [OptionalParameterNode(:a, Location(), Location(), IntegerNode(IntegerBaseFlags::DECIMAL))], [RequiredParameterNode(:b)], RestParameterNode(:c, Location(), Location()), [], nil, nil),
1126+
ParametersNode([], [OptionalParameterNode(:a, Location(), Location(), IntegerNode(IntegerBaseFlags::DECIMAL))], RestParameterNode(:c, Location(), Location()), [RequiredParameterNode(:b)], [], nil, nil),
11271127
nil,
11281128
[:a, :b, :c],
11291129
Location(),

test/yarp/snapshots/blocks.txt

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/yarp/snapshots/break.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/yarp/snapshots/if.txt

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/yarp/snapshots/keyword_method_names.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/yarp/snapshots/lambda.txt

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)