File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
test/elixir/code_formatter Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -553,6 +553,10 @@ defmodule Code.Formatter do
553553 if keyword_key? ( left_arg ) do
554554 { left , state } =
555555 case left_arg do
556+ # TODO: Remove this clause in v1.16 when we no longer quote operator :..//
557+ { :__block__ , _ , [ :"..//" ] } ->
558+ { string ( ~S{ "..//":} ) , state }
559+
556560 { :__block__ , _ , [ atom ] } when is_atom ( atom ) ->
557561 key =
558562 case Code.Identifier . classify ( atom ) do
@@ -1533,6 +1537,11 @@ defmodule Code.Formatter do
15331537 Atom . to_string ( atom )
15341538 end
15351539
1540+ # TODO: Remove this clause in v1.16 when we no longer quote operator :..//
1541+ defp atom_to_algebra ( :"..//" ) do
1542+ string ( ":\" ..//\" " )
1543+ end
1544+
15361545 defp atom_to_algebra ( atom ) do
15371546 string = Atom . to_string ( atom )
15381547
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ defmodule Code.Formatter.LiteralsTest do
107107 assert_format ~S[ :"++"] , ~S[ :++]
108108 end
109109
110+ test "quoted operators" do
111+ assert_same ~S[ :"::"]
112+ assert_same ~S[ :"..//"]
113+ assert_format ~S[ :..//] , ~S[ :"..//"]
114+ assert_format ~S{ [..//: 1]} , ~S{ ["..//": 1]}
115+ assert_same ~S{ ["..//": 1]}
116+ end
117+
110118 test "uses double quotes even when single quotes are used" do
111119 assert_format ~S[ :'foo bar'] , ~S[ :"foo bar"]
112120 end
You can’t perform that action at this time.
0 commit comments