Skip to content

Commit

Permalink
Revert unneccesary changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Qqwy committed May 31, 2022
1 parent 82bda8e commit f0b489e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions lib/type_check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ defmodule TypeCheck do
case unquote(check) do
{:ok, bindings, altered_value} -> {:ok, altered_value}
{:error, problem} ->
# Use apply to silence Dialyzer
exception = apply(TypeCheck.TypeError, :exception, [{problem, unquote(Macro.Env.location(__CALLER__))}])
exception = TypeCheck.TypeError.exception({problem, unquote(Macro.Env.location(__CALLER__))})
{:error, exception}
end
end
Expand Down Expand Up @@ -282,8 +281,7 @@ defmodule TypeCheck do
{:current_stacktrace, [_ , caller | _]} = Process.info(self(), :current_stacktrace)
location = elem(caller, 3)
location = update_in(location[:file], &to_string/1)
# Use apply to silence Dialyzer
exception = apply(TypeCheck.TypeError, :exception, [{problem, location}])
exception = TypeCheck.TypeError.exception({problem, location})
{:error, exception}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/type_check/spec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ defmodule TypeCheck.Spec do

Kernel.unquote(function_kind)(unquote(name)(unquote_splicing(clean_params)), do: unquote(body))

# The result is checed in a separate function
# The result is checked in a separate function
# This ensures we can convince Dialyzer to skip it. c.f. #85
@compile {:inline, [{unquote(return_spec_fun_name), unquote(arity + 1)}]}
@dialyzer {:nowarn_function, [{unquote(return_spec_fun_name), unquote(arity + 1)}]}
Expand Down
2 changes: 0 additions & 2 deletions lib/type_check/type_error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ defmodule TypeCheck.TypeError do

@impl true

@dialyzer {:nowarn_function, [exception: 1]}
@dialyzer :no_opaque
def exception({problem_tuple, location}) do
message = TypeCheck.TypeError.DefaultFormatter.format(problem_tuple, location)

Expand Down

0 comments on commit f0b489e

Please sign in to comment.