fix: properly optimized nested get_path calls

This commit is contained in:
Zach Daniel 2023-08-23 12:51:35 -04:00
parent 221280f1f5
commit 97ab3272db

View file

@ -127,15 +127,20 @@ defmodule Ash.Expr do
left = do_expr(left, false)
right = do_expr(right, false)
[left, right]
|> Ash.Query.Function.GetPath.new()
|> case do
{:ok, call} ->
soft_escape(call, escape?)
soft_escape(
quote do
[unquote(left), unquote(right)]
|> Ash.Query.Function.GetPath.new()
|> case do
{:ok, call} ->
call
{:error, error} ->
raise error
end
{:error, error} ->
raise error
end
end,
escape?
)
end
def do_expr({{:., _, [_, _]} = left, _, []}, escape?) do