Skip to content

Commit

Permalink
improvement: fix lexical import error in DSL macros
Browse files Browse the repository at this point in the history
we now only unimport and reimport other DSL extension sections
when processing a top level section
  • Loading branch information
zachdaniel committed Jul 27, 2023
1 parent 32f79c7 commit 1382584
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/spark/dsl/extension.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1047,17 +1047,25 @@ defmodule Spark.Dsl.Extension do
end)

other_extension_unimports =
for extension <- Module.get_attribute(__CALLER__.module, :extensions) do
quote do
import unquote(extension), only: []
if unquote(path) == [] do
for extension <- Module.get_attribute(__CALLER__.module, :extensions) do
quote do
import unquote(extension), only: []
end
end
else
[]
end

other_extension_reimports =
for extension <- Module.get_attribute(__CALLER__.module, :extensions) do
quote do
import unquote(extension), only: :macros
if unquote(path) == [] do
for extension <- Module.get_attribute(__CALLER__.module, :extensions) do
quote do
import unquote(extension), only: :macros
end
end
else
[]
end

entity_imports ++
Expand Down

0 comments on commit 1382584

Please sign in to comment.