Error in Elixir 1.15 trying to use the module TypeCheck.Type which is currently being defined
sjmueller opened this issue · comments
After upgrading to Elixir 1.15.0 (compiled with Erlang/OTP 25)
we're faced with this error at compile time:
error: you are trying to use/import/require the module TypeCheck.Type which is currently being defined.
This may happen if you accidentally override the module you want to use. For example:
defmodule MyApp do
defmodule Supervisor do
use Supervisor
end
end
In the example above, the new Supervisor conflicts with Elixir's Supervisor. This may be fixed by using the fully qualified name in the definition:
defmodule MyApp.Supervisor do
use Supervisor
end
lib/type_check.ex:141: TypeCheck.Type (module)
== Compilation error in file lib/type_check/internals/bootstrap.ex ==
** (CompileError) lib/type_check/type.ex: cannot compile module TypeCheck.Type (errors have been logged)
expanding macro: TypeCheck.__using__/1
lib/type_check/type.ex:7: TypeCheck.Type (module)
(elixir 1.15.0) expanding macro: Kernel.use/1
lib/type_check/type.ex:7: TypeCheck.Type (module)
expanding macro: TypeCheck.Internals.Bootstrap.Macros.if_recompiling?/1
The error does NOT occur in previous version Elixir 1.14.5 (compiled with Erlang/OTP 25)
What a peculiar issue. Something must have changed in the new Elixir version that doesn't like the way TypeCheck is dogfooding itself.
Thank you very much for reporting this problem!
We're guessing it has something to do with code path pruning
mentioned in release notes: https://github.com/elixir-lang/elixir/releases
We tried the recommendation of prune_code_paths: false
, but it did not fix the error.
@Qqwy Since Jose Valim already posted a working diff - when can we expected to have a new release which works on 1.15? :)
Version 0.13.5
has been released which supports Elixir v1.15. 🚀
Check #186 for details on what was necessary to make this work.
Most importantly, some 'dogfooding' checks where TypeCheck uses itself had to be turned off. These should be re-introduced in a future version. #187 was opened to track this.