diff options
author | nagachika <nagachika@ruby-lang.org> | 2024-02-25 14:03:05 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2024-02-25 14:03:05 +0900 |
commit | 1b9ff146e38c348519434754e0466352b8b25c50 (patch) | |
tree | fbc2a944011a6db5134cfde3b61cf343b213ae3b | |
parent | 24dd529750c08b5603fb418a4f34998b9bf6c8f9 (diff) |
Revert "merge revision(s) c8d162c889008028b148437d02f36f4edaa749fd: [Backport #19973]"
This reverts commit 24dd529750c08b5603fb418a4f34998b9bf6c8f9.
-rw-r--r-- | parse.y | 10 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 6 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 5 insertions, 13 deletions
@@ -12889,17 +12889,15 @@ remove_duplicate_keys(struct parser_params *p, NODE *hash) NODE *result = 0; NODE *last_expr = 0; rb_code_location_t loc = hash->nd_loc; - while (hash && hash->nd_next) { + while (hash && hash->nd_head && hash->nd_next) { NODE *head = hash->nd_head; NODE *value = hash->nd_next; NODE *next = value->nd_next; st_data_t key = (st_data_t)head; st_data_t data; value->nd_next = 0; - if (!head) { - } - else if (nd_type_p(head, NODE_LIT) && - st_delete(literal_keys, (key = (st_data_t)head->nd_lit, &key), &data)) { + if (nd_type_p(head, NODE_LIT) && + st_delete(literal_keys, (key = (st_data_t)head->nd_lit, &key), &data)) { NODE *dup_value = ((NODE *)data)->nd_next; rb_compile_warn(p->ruby_sourcefile, nd_line((NODE *)data), "key %+"PRIsVALUE" is duplicated and overwritten on line %d", @@ -12912,7 +12910,7 @@ remove_duplicate_keys(struct parser_params *p, NODE *hash) } } st_insert(literal_keys, (st_data_t)key, (st_data_t)hash); - last_expr = !head || nd_type_p(head, NODE_LIT) ? value : head; + last_expr = nd_type_p(head, NODE_LIT) ? value : head; hash = next; } st_foreach(literal_keys, append_literal_keys, (st_data_t)&result); diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index f9b807d1e9..29de9b18c7 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -336,12 +336,6 @@ class TestSyntax < Test::Unit::TestCase assert_warn(/duplicated/) {r = eval("a.f(**{k: a.add(1), j: a.add(2), k: a.add(3), k: a.add(4)})")} assert_equal(4, r) assert_equal([1, 2, 3, 4], a) - a.clear - r = nil - z = {} - assert_warn(/duplicated/) {r = eval("a.f(k: a.add(1), **z, k: a.add(2))")} - assert_equal(2, r) - assert_equal([1, 2], a) end def test_keyword_empty_splat @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 3 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 159 +#define RUBY_PATCHLEVEL 158 #include "ruby/version.h" #include "ruby/internal/abi.h" |