Skip to content

Commit

Permalink
Fix typespecs
Browse files Browse the repository at this point in the history
  • Loading branch information
avillen committed Oct 2, 2020
1 parent 47c703b commit db3f798
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/as_nested_set/modifiable.ex
Expand Up @@ -5,6 +5,7 @@ defmodule AsNestedSet.Modifiable do
import AsNestedSet.Helper

@spec create(AsNestedSet.t(), AsNestedSet.t(), position) :: AsNestedSet.executable()
@spec create(AsNestedSet.t(), nil, :root) :: AsNestedSet.executable()
def create(new_model, target \\ nil, position) when is_atom(position) do
fn repo ->
case validate_create(new_model, target, position) do
Expand Down Expand Up @@ -217,7 +218,7 @@ defmodule AsNestedSet.Modifiable do
|> repo.one
end

@spec delete(AsNestedSet.t()) :: AsNestedSet.exectuable()
@spec delete(AsNestedSet.t()) :: AsNestedSet.executable()
def delete(%{__struct__: struct} = model) do
fn repo ->
left = get_field(model, :left)
Expand Down Expand Up @@ -250,7 +251,7 @@ defmodule AsNestedSet.Modifiable do
end

@spec move(AsNestedSet.t(), AsNestedSet.t(), position) :: AsNestedSet.executable()
@spec move(AsNestedSet.t(), :root) :: AsNestedSet.executable()
@spec move(AsNestedSet.t(), nil, :root) :: AsNestedSet.executable()
def move(%{__struct__: _} = model, target \\ nil, position) when is_atom(position) do
fn repo ->
model = do_reload(repo, model)
Expand Down
4 changes: 2 additions & 2 deletions lib/as_nested_set/scoped.ex
Expand Up @@ -24,7 +24,7 @@ defmodule AsNestedSet.Scoped do
do_same_scope?(source, target)
end

@spec scoped_query(Ecto.Query.t(), Map.t()) :: Ecto.Query.t()
@spec scoped_query(Ecto.Query.t(), map()) :: Ecto.Query.t()
def scoped_query(query, scope) do
%Ecto.Query.FromExpr{source: {_, module}} = query.from
do_scoped_query(query, scope, module.__as_nested_set_scope__())
Expand All @@ -39,7 +39,7 @@ defmodule AsNestedSet.Scoped do
end)
end

@spec scope(any) :: Map.t()
@spec scope(any) :: map()
def scope(%{__struct__: struct} = target) do
scope = struct.__as_nested_set_scope__

Expand Down
2 changes: 1 addition & 1 deletion lib/as_nested_set/traversable.ex
Expand Up @@ -4,7 +4,7 @@ defmodule AsNestedSet.Traversable do
(AsNestedSet.t(), [AsNestedSet.t()], any -> {AsNestedSet.t(), any})
| (AsNestedSet.t(), any -> {AsNestedSet.t(), any})

@spec traverse(AsNestedSet.Scoped, any, pre_fun, post_fun) ::
@spec traverse(AsNestedSet.t(), any, pre_fun, post_fun) ::
(Ecto.Repo.t() -> {AsNestedSet.t(), any})
def traverse(%{__struct__: _} = node, context, pre, post) do
fn repo ->
Expand Down

0 comments on commit db3f798

Please sign in to comment.