-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation error when using conforms?
#146
Comments
Thank you for your bug report. 😊 |
I started working on this. To be able to support recursive types and the likes, we currently:
However, it seems that when you use a macro inside a function and refer to a type from within, then this macro's expansion happens before the At this point we do have some of the type information available inside a module attribute ( However, I do not have an alternative idea as of right now. |
Essentially, the problem is the same as in this minimal example: defmodule MacroModule do
defmacro precompute(x) do
result = Code.eval_quoted(x)
quote do
unquote(result)
end
end
end
defmodule Example do
require MacroModule
def foo() do
42
end
def bar(y) do
MacroModule.precompute(foo()) * 3
end
end ** (UndefinedFunctionError) function Example.foo/0 is undefined (function not available)
Example.foo()
nofile:23: (file)
iex:16: (file) I do not think there is a way to fix this problem in the general sense. |
When a type is defined as follows:
TypeCheck
works correctly, but if I try to useTypeCheck.conforms?
in the same module where a type is defined, I get a complation error:The text was updated successfully, but these errors were encountered: