Skip to content

Commit 1fd0fc3

Browse files
authored
Fix dialyzer overlapping contract in comment_block.ex (#649)
From dialyzer: ``` lib/language_server/providers/folding_range/comment_block.ex:46:overlapping_contract Overloaded contract for ElixirLS.LanguageServer.Providers.FoldingRange.CommentBlock.group_comments/1 has overlapping domains; such contracts are currently unsupported and are simply ignored. ``` It's happens because of declare `group_comments` spec on `convert_comment_group_to_range/1`. But after fix it to correct name, dialyzer will complain invalid contract because `convert_comment_group_to_range` receive `[[{Line.cell(), String.t()}]]` and it's returns `FoldingRange.t()` not a list.
1 parent bb3039c commit 1fd0fc3

File tree

1 file changed

+2
-2
lines changed
  • apps/language_server/lib/language_server/providers/folding_range

1 file changed

+2
-2
lines changed

apps/language_server/lib/language_server/providers/folding_range/comment_block.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule ElixirLS.LanguageServer.Providers.FoldingRange.CommentBlock do
4343
{:ok, ranges}
4444
end
4545

46-
@spec group_comments([Line.t()]) :: [{Line.cell(), String.t()}]
46+
@spec group_comments([Line.t()]) :: [[{Line.cell(), String.t()}]]
4747
defp group_comments(lines) do
4848
lines
4949
|> Enum.reduce([[]], fn
@@ -62,7 +62,7 @@ defmodule ElixirLS.LanguageServer.Providers.FoldingRange.CommentBlock do
6262
|> Enum.filter(fn group -> length(group) > 1 end)
6363
end
6464

65-
@spec group_comments([{Line.cell(), String.t()}]) :: [FoldingRange.t()]
65+
@spec convert_comment_group_to_range([[{Line.cell(), String.t()}]]) :: FoldingRange.t()
6666
defp convert_comment_group_to_range(group) do
6767
{{{end_line, _}, _}, {{start_line, _}, _}} =
6868
group |> FoldingRange.Helpers.first_and_last_of_list()

0 commit comments

Comments
 (0)