Skip to content

Instantly share code, notes, and snippets.

@jonnystorm
Created January 5, 2015 21:29
Show Gist options
  • Save jonnystorm/5fb5aa7a543313e0af38 to your computer and use it in GitHub Desktop.
Save jonnystorm/5fb5aa7a543313e0af38 to your computer and use it in GitHub Desktop.
Demonstrate surprising Dialyzer warning for list comprehension
defmodule Demo do
def test1a, do: [1]
def test1b(x) do
# demo.ex:6: The created fun has no local return
for e <- test1a, do: x
end
def test2a, do: 1
def test2b(x) do
for e <- [test2a], do: x
end
def test3a, do: [1]
def test3b(x) do
for e <- test3a, do: 1
end
def test4a, do: [1]
def test4b do
for e <- test4a, do: e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment