Skip to content

Incorrect escaping of sigils in Inspect protocol #6255

@lpil

Description

@lpil

Environment

Erlang/OTP 19
Elixir 1.4.5

Current behaviour

I've been working a bunch with sigil escaping and I discovered that the Inspect protocol incorrectly prints some sigils with tricky escaping in them.

iex(1)> ~r" \\/ "
~r/ \\/ /
iex(2)> ~r/ \\/ /
...(2)> # Sigil isn't complete!

Expected behaviour

I expected this: ~r/ \\\/ /

However when testing this happened, so I'm unsure:

iex(1)> ~r/ \\\/ / == ~r" \\/ "
false
iex(1)> quote do: ~r/ \\\/ /
{:sigil_r, [context: Elixir, import: Kernel], [{:<<>>, [], [" \\\\/ "]}, []]}
iex(2)> quote do: ~r" \/ "
{:sigil_r, [context: Elixir, import: Kernel], [{:<<>>, [], [" \\/ "]}, []]}

Is this parsing correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions