Skip to content

Commit

Permalink
fill tuple fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Nov 27, 2023
1 parent 9842dc1 commit 56a5cdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/elixir_sense/core/guard.ex
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ defmodule ElixirSense.Core.Guard do
when p in [:==, :===] do
type =
if is_integer(size) do
{:tuple, size, []}
{:tuple, size, if(size > 0, do: Enum.map(1..size, fn _ -> nil end), else: [])}
else
:tuple
end
Expand Down
2 changes: 1 addition & 1 deletion test/elixir_sense/core/metadata_builder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ defmodule ElixirSense.Core.MetadataBuilderTest do

test "tuple guards" do
assert %VarInfo{name: :x, type: :tuple} = var_with_guards("is_tuple(x)")
assert %VarInfo{name: :x, type: {:tuple, 1, []}} = var_with_guards("tuple_size(x) == 1")
assert %VarInfo{name: :x, type: {:tuple, 1, [nil]}} = var_with_guards("tuple_size(x) == 1")
assert %VarInfo{name: :x, type: :tuple} = var_with_guards("elem(x, 0) == 1")
end

Expand Down

0 comments on commit 56a5cdb

Please sign in to comment.