Skip to content

Commit

Permalink
Merge pull request #5 from turion/fix_27
Browse files Browse the repository at this point in the history
Expand `alias __MODULE__` manually. Fixes gyson#27
  • Loading branch information
turion authored Feb 14, 2022
2 parents 23ab714 + 885c7c7 commit 9a91b58
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ex_type/custom_env.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ defmodule ExType.CustomEnv do

new_alias = {:__aliases__, meta, new_alias_prefix ++ tokens}

# Manually expand `alias __MODULE__`, see https://github.com/gyson/ex_type/issues/27
block = block
|> Macro.prewalk(fn
{:alias, meta_alias, [{:__MODULE__, meta_module, nil}]} -> {:alias, meta_alias, [{:__aliases__, meta_module, tokens}]}
token -> token
end)

quote do
Kernel.defmodule unquote(new_alias) do
@before_compile ExType.CustomEnv.BeforeCompile
Expand Down

0 comments on commit 9a91b58

Please sign in to comment.