Skip to content
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

Error in Elixir 1.15 trying to use the module TypeCheck.Type which is currently being defined #185

Closed
sjmueller opened this issue Jun 27, 2023 · 5 comments · Fixed by #186
Labels
bug Something isn't working

Comments

@sjmueller
Copy link

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)

@Qqwy Qqwy added the bug Something isn't working label Jun 27, 2023
@Qqwy
Copy link
Owner

Qqwy commented Jun 27, 2023

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!

@sjmueller
Copy link
Author

sjmueller commented Jun 27, 2023

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.

@YannickFricke
Copy link

@Qqwy Since Jose Valim already posted a working diff - when can we expected to have a new release which works on 1.15? :)

@Qqwy
Copy link
Owner

Qqwy commented Jul 4, 2023 via email

@Qqwy Qqwy mentioned this issue Jul 4, 2023
4 tasks
@Qqwy Qqwy closed this as completed in #186 Jul 4, 2023
@Qqwy
Copy link
Owner

Qqwy commented Jul 4, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants