Skip to content

Commit

Permalink
Merge pull request elixir-lang#590 from yrashk/typespec-build-fix
Browse files Browse the repository at this point in the history
Typespec build fix
  • Loading branch information
José Valim committed Oct 29, 2012
2 parents 591b95b + a6d86d9 commit 18fd040
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -137,6 +137,6 @@ dialyze: compile .dialyzer.base_plt
@ rm -f .dialyzer_plt
@ cp .dialyzer.base_plt .dialyzer_plt
@ echo "==> Adding Elixir to PLT..."
@ dialyzer --output_plt .dialyzer_plt --add_to_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
@ dialyzer --plt .dialyzer_plt --add_to_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
@ echo "==> Dialyzing Elixir..."
@ dialyzer --plt .dialyzer_plt -r lib/elixir/ebin lib/ex_unit/ebin lib/mix/ebin lib/iex/ebin lib/eex/ebin
8 changes: 4 additions & 4 deletions lib/elixir/lib/kernel/typespec.ex
Expand Up @@ -51,7 +51,7 @@ defmodule Kernel.Typespec do
def callback_from_spec(module, name, arity) do
table = spec_table_for(module)
pairs = :ets.lookup(table, { :spec, { name, arity } })
specs = Enum.reduce(pairs, [], fn { _key, specs }, acc -> acc ++ specs end)
specs = :lists.foldl(fn { _key, specs }, acc -> acc ++ specs end, [], pairs)

if specs != [] do
:ets.insert(table, { { :callback, { name, arity } }, specs })
Expand All @@ -65,7 +65,7 @@ defmodule Kernel.Typespec do

# Handle unions
defp typespec({ :|, line, [_,_] } = exprs, vars, caller) do
exprs = Enum.reverse(collect_union(exprs))
exprs = :lists.reverse(collect_union(exprs))
union = lc e inlist exprs, do: typespec(e, vars, caller)
{ :type, line, :union, union }
end
Expand Down Expand Up @@ -130,8 +130,8 @@ defmodule Kernel.Typespec do
# Handle funs
defp typespec({:fun, line, arguments}, vars, caller) when is_list(arguments) do
args =
case Enum.reverse(arguments) do
[[{:do,h}]|t] -> fn_args(line, Enum.reverse(t), h, vars, caller)
case :lists.reverse(arguments) do
[[{:do,h}]|t] -> fn_args(line, :lists.reverse(t), h, vars, caller)
[] -> []
_ -> [fn_args(line, arguments, vars, caller)]
end
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/lib/protocol.ex
Expand Up @@ -118,7 +118,7 @@ defmodule Protocol do
@doc false
def meta(functions, conversions, fallback, any, env) do
contents = quote do
@type t :: unquote(generate_type(conversions, any))
Kernel.Typespec.deftype(t :: unquote(generate_type(conversions, any)))

def __protocol__(:name), do: __MODULE__
def __protocol__(:functions), do: unquote(:lists.sort(functions))
Expand Down Expand Up @@ -353,7 +353,7 @@ defmodule Protocol.DSL do
# Convert the spec to callback if possible,
# otherwise generate a dummy callback
Kernel.Typespec.callback_from_spec(__MODULE__, name, arity) ||
@callback unquote(name)(unquote_splicing(type_args)), do: term
Kernel.Typespec.defcallback(unquote(name)(unquote_splicing(type_args)), do: term)
end
end
end
6 changes: 3 additions & 3 deletions lib/elixir/src/elixir_compiler.erl
Expand Up @@ -205,20 +205,20 @@ core_main() ->
[
"lib/elixir/lib/kernel.ex",
"lib/elixir/lib/keyword.ex",
"lib/elixir/lib/list.ex",
"lib/elixir/lib/kernel/typespec.ex",
"lib/elixir/lib/record.ex",
"lib/elixir/lib/macro.ex",
"lib/elixir/lib/macro/env.ex",
"lib/elixir/lib/module.ex",
"lib/elixir/lib/list.ex",
"lib/elixir/lib/code.ex",
"lib/elixir/lib/protocol.ex",
"lib/elixir/lib/enum.ex",
"lib/elixir/lib/exception.ex",
"lib/elixir/lib/binary/inspect.ex",
"lib/elixir/lib/binary/chars.ex",
"lib/elixir/lib/list/chars.ex",
"lib/elixir/lib/gen_server/behaviour.ex",
"lib/elixir/lib/kernel/typespec.ex"
"lib/elixir/lib/gen_server/behaviour.ex"
].

%% ERROR HANDLING
Expand Down

0 comments on commit 18fd040

Please sign in to comment.