Created
December 5, 2013 14:42
-
-
Save chrismccord/7806146 to your computer and use it in GitHub Desktop.
Elixir 0.11 record bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This worked on 0.10 | |
defmodule Records do | |
defmacro __using__(_) do | |
quote do | |
defrecord A, name: "chris" | |
defrecord B, id: nil, nested: A.new | |
end | |
end | |
end | |
defmodule Example do | |
use Records | |
end | |
# On 0.11 throws == Compilation error on file ./record_bug.ex == | |
# ** (UndefinedFunctionError) undefined function: A.new/0 | |
# Updating to use __MODULE__ prefix fixes issues on 0.11 | |
defmodule Records do | |
defmacro __using__(_) do | |
quote do | |
defrecord A, name: "chris" | |
defrecord B, id: nil, nested: __MODULE__.A.new | |
end | |
end | |
end | |
defmodule Example do | |
use Records | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment