Project

General

Profile

Bug #15670

Ripper treats :"sym" as xstring

Added by ktsj (Kazuki Tsujimoto) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
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]]]]

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

#1

Updated by ktsj (Kazuki Tsujimoto) over 1 year 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 1 year 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 1 year 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.

#4

Updated by usa (Usaku NAKAMURA) over 1 year 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 1 year 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.

Also available in: Atom PDF