Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Add regression test for gyson#20

* Allow functions without argument brackets. Fix gyson#20.

Co-authored-by: Manuel Bärenz <m.baerenz@sonnen.de>
  • Loading branch information
turion and Manuel Bärenz authored Dec 25, 2020
1 parent 25e4ef6 commit 57262fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ex_type/custom_env.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ defmodule ExType.CustomEnv do

(defs ++ defps)
# support "mix type" with filter
|> Enum.map(fn
{{:when, meta_when, [{name, meta, args}, guards]}, block} ->
{{:when, meta_when, [{name, meta, args || []}, guards]}, block}

{{name, meta, args}, block} ->
{{name, meta, args || []}, block}
end)
|> Enum.map(fn
{{:when, _, [{name, _meta, args}, _guards]} = call, block} ->
{call, block, name, length(args)}
Expand Down
6 changes: 6 additions & 0 deletions test/ex_type/checker_test_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ defmodule ExType.CheckerTestCase do
other
end
end

@spec test_case_3() :: integer()

def test_case_3 do
23
end
end

0 comments on commit 57262fe

Please sign in to comment.