From: "tompng (tomoya ishida) via ruby-core" Date: 2023-12-09T17:49:56+00:00 Subject: [ruby-core:115678] [Ruby master Bug#20055] Ripper seems to skip some checks like `void value expression` and `duplicated variable name` Issue #20055 has been reported by tompng (tomoya ishida). ---------------------------------------- Bug #20055: Ripper seems to skip some checks like `void value expression` and `duplicated variable name` https://bugs.ruby-lang.org/issues/20055 * Author: tompng (tomoya ishida) * Status: Open * Priority: Normal * ruby -v: ruby 3.3.0dev (2023-12-08T07:01:01Z master f2c84c4884) [x86_64-linux] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- These are syntax error ~~~ruby return + return # void value expression 1 in [a, a] # duplicated variable name 1 + (1 => [a, a]) # both ~~~ But Ripper.sexp returns S-expression, not nil ~~~ruby Ripper.sexp 'return + return' # => [:program, [[:return, [:args_add_block, [[:unary, :+@, [:return0]]], false]]]] Ripper.sexp '1 in [a, a]' # => [:program, [[:case, [:@int, "1", [1, 0]], [:in, [:aryptn, nil, [[:var_field, [:@ident, "a", [1, 6]]], [:var_field, [:@ident, "a", [1, 9]]]], nil, nil], nil, nil]]]] Ripper.sexp '1 + (1 => [a, a]) # both' # => [:program, [[:binary, [:@int, "1", [1, 0]], :+, [:paren, [[:case, [:@int, "1", [1, 5]], [:in, [:aryptn, nil, [[:var_field, [:@ident, "a", [1, 11]]], [:var_field, [:@ident, "a", [1, 14]]]], nil, nil], nil, nil]]]]]]] ~~~ -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/