Skip to content

Commit 05ea318

Browse files
committed
fix tests on 1.17 and 1.18
1 parent a96edc7 commit 05ea318

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/elixir_sense/core/compiler_test.exs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,11 +979,29 @@ defmodule ElixirSense.Core.CompilerTest do
979979
meta = Keyword.delete(meta, :capture)
980980
{{:fn, meta, args}, state}
981981

982+
# Normalize binding variables in quote bind_quoted
983+
# ElixirSense (1.19+ behavior) removes :column, but Elixir < 1.19 keeps it
984+
{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]} = _node, state
985+
when is_atom(var_name) and is_list(var_meta) and is_atom(context) ->
986+
# Add :column back for Elixir < 1.19
987+
var_meta =
988+
if Version.match?(System.version(), "< 1.19.0") do
989+
# For Elixir < 1.19, add :column: 1 if not present
990+
case Keyword.has_key?(var_meta, :column) do
991+
true -> var_meta
992+
false -> [{:column, 1} | var_meta]
993+
end
994+
else
995+
var_meta
996+
end
997+
998+
{{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]}, state}
999+
9821000
{atom, meta, nil} = node, state when is_atom(atom) ->
9831001
# ElixirSense intentionally uses :"&#{pos}" instead of :capture
9841002
# Convert to :capture to match Elixir 1.17+ behavior
9851003
node =
986-
with "&" <> int <- to_string(atom), {pos, ""} <- Integer.parse(int) do
1004+
with "&" <> int <- to_string(atom), {_pos, ""} <- Integer.parse(int) do
9871005
# Normalize metadata
9881006
meta =
9891007
if Version.match?(System.version(), "< 1.17.0") do

0 commit comments

Comments
 (0)