If I have nested modules is it possible to use the syntax __MODULE__ in the submodule? I’m getting an error that says “cannot access struct RootModule …” when I have something like this:
defmodule RootModule do
defmodule SubModule do
defstruct [:foo, :bar]
@spec new() :: %__MODULE__{}
def new() do
%__MODULE__{}
end
end
end
ah criminy. different typo. I had inserted a wayward end somewhere above the function definition so the submodule was “closed” and the function was being defined in the root module. derp.