Skip to content

Commit a990895

Browse files
committed
fix: unrelated dialyzer issues
1 parent 4ed168b commit a990895

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

lib/ash/action_input.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ defmodule Ash.ActionInput do
9898
resource: Ash.Resource.t(),
9999
invalid_keys: MapSet.t(),
100100
context: map(),
101-
domain: Ash.Domain.t(),
101+
domain: Ash.Domain.t() | nil,
102102
valid?: boolean(),
103103
errors: [Ash.Error.t()],
104104
before_action: [before_action_fun],
@@ -132,7 +132,7 @@ defmodule Ash.ActionInput do
132132
- `set_argument/3` for adding arguments
133133
- `set_context/2` for adding context
134134
"""
135-
@spec new(Ash.Resource.t(), Ash.Domain.t()) :: t
135+
@spec new(Ash.Resource.t(), Ash.Domain.t() | nil) :: t
136136
def new(resource, domain \\ nil) do
137137
%__MODULE__{resource: resource, domain: domain}
138138
end

lib/ash/changeset/changeset.ex

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,7 @@ defmodule Ash.Changeset do
104104
defimpl Inspect do
105105
import Inspect.Algebra
106106

107-
@spec inspect(Ash.Changeset.t(), Inspect.Opts.t()) ::
108-
{:doc_cons, :doc_line | :doc_nil | binary | tuple,
109-
:doc_line | :doc_nil | binary | tuple}
110-
| {:doc_group,
111-
:doc_line
112-
| :doc_nil
113-
| binary
114-
| {:doc_collapse, pos_integer}
115-
| {:doc_force, any}
116-
| {:doc_break | :doc_color | :doc_cons | :doc_fits | :doc_group | :doc_string, any,
117-
any}
118-
| {:doc_nest, any, :cursor | :reset | non_neg_integer, :always | :break},
119-
:inherit | :self}
107+
@spec inspect(Ash.Changeset.t(), Inspect.Opts.t()) :: Inspect.Algebra.t()
120108
def inspect(changeset, opts) do
121109
context = Map.delete(changeset.context, :private)
122110

@@ -526,21 +514,22 @@ defmodule Ash.Changeset do
526514
context = Ash.Resource.Info.default_context(resource) || %{}
527515

528516
if Ash.Resource.Info.resource?(resource) do
529-
%__MODULE__{resource: resource, data: record, action_type: action_type}
517+
new_changeset(resource, record, action_type)
530518
|> set_context(context)
531519
|> set_tenant(tenant)
532520
else
533-
%__MODULE__{
534-
resource: resource,
535-
action_type: action_type,
536-
data: struct(resource)
537-
}
521+
new_changeset(resource, struct(resource), action_type)
538522
|> add_error(NoSuchResource.exception(resource: resource))
539523
|> set_tenant(tenant)
540524
|> set_context(context)
541525
end
542526
end
543527

528+
@spec new_changeset(Ash.Resource.t(), term(), atom()) :: t()
529+
defp new_changeset(resource, data, action_type) do
530+
%__MODULE__{resource: resource, data: data, action_type: action_type}
531+
end
532+
544533
@doc """
545534
Ensure that only the specified attributes are present in the results.
546535

0 commit comments

Comments
 (0)