Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 22 additions & 27 deletions lib/expr.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3490,35 +3490,30 @@ defmodule AshSql.Expr do
end

defp maybe_type_expr(query, expr, bindings, embedded?, acc, type) do
cond do
type && get_path_array_type?(type) ->
case strip_get_path_type(expr) do
%GetPath{} = get_path ->
get_untyped_get_path_expr(query, get_path, bindings, embedded?, acc)

_ ->
do_dynamic_expr(query, expr, bindings, embedded?, acc, type)
end

type ->
{type, constraints} =
case type do
{:array, type} -> {{:array, type}, []}
{type, constraints} -> {type, constraints}
type -> {type, []}
end
if type do
case strip_get_path_type(expr) do
%GetPath{} = get_path ->
get_untyped_get_path_expr(query, get_path, bindings, embedded?, acc)

do_dynamic_expr(
query,
%Ash.Query.Function.Type{arguments: [expr, type, constraints]},
bindings,
embedded?,
acc,
type
)
_ ->
{type, constraints} =
case type do
{:array, type} -> {{:array, type}, []}
{type, constraints} -> {type, constraints}
type -> {type, []}
end

true ->
do_dynamic_expr(query, expr, bindings, embedded?, acc, type)
do_dynamic_expr(
query,
%Ash.Query.Function.Type{arguments: [expr, type, constraints]},
bindings,
embedded?,
acc,
type
)
end
else
do_dynamic_expr(query, expr, bindings, embedded?, acc, type)
end
end

Expand Down
Loading