Project

General

Profile

Actions

Bug #15670

closed

Ripper treats :"sym" as xstring

Added by ktsj (Kazuki Tsujimoto) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-03-15 master 67269) [x86_64-linux]
[ruby-core:91852]

Description

Ripperで :"sym" をパースするとxstringとして扱われるようになっていますが、
{"sym": ...} と同様にstringとして扱われるべきだと思います。

$ ruby -rripper -e '_, (_, _, s) = Ripper.sexp_raw(%q{:"sym"}); p s'
[:dyna_symbol, [:xstring_add, [:xstring_new], [:@tstring_content, "sym", [1, 2]]]]

$ ruby -rripper -e '_, (_, _, (_, (_, ((_, s))))) = Ripper.sexp_raw(%q{{"sym": 0}}); p s'
[:dyna_symbol, [:string_add, [:string_content], [:@tstring_content, "sym", [1, 2]]]]

バックポートすべきか微妙な修正のような気もしますが、一応バックポートチケットとして起票しておきます。

Actions #1

Updated by ktsj (Kazuki Tsujimoto) over 5 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r67270.


dsym should be treated as string [ruby-core:91852] [Bug #15670]

Updated by naruse (Yui NARUSE) over 5 years ago

  • Backport changed from 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: DONE

ruby_2_6 r67352 merged revision(s) 67270.

Updated by ujihisa (Tatsuhiro Ujihisa) over 5 years ago

This change broke a library preval https://github.com/kddeisz/preval/issues/1, and potentially also breaks other libraries that uses Ripper. Since this is an incompatible change for Ripper.sexp, I guess backport requires a loud changelog note for developers who use ripper.

Actions #4

Updated by usa (Usaku NAKAMURA) over 5 years ago

  • Backport changed from 2.4: UNKNOWN, 2.5: REQUIRED, 2.6: DONE to 2.4: WONTFIX, 2.5: DONE, 2.6: DONE

Updated by skalee (Sebastian Skalacki) over 5 years ago

YARD is also broken, though I'm not sure how severe is that: https://github.com/lsegal/yard/issues/1243. I suspect this very change.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0