Skip to content

Strange compilation error with duplicate module resolution and running mix test #13040

@wkirschbaum

Description

@wkirschbaum

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 26)

Operating system

GNU Linux

Current behavior

With the following steps to reproduce:

$ mix new foo
$ cd foo
$ mix test ( passes )

$ cp lib/foo.ex lib/bar.ex
$ mix test ( passes with warning )

edit lib/bar.ex and change module name from

defmodule Foo do
...

to

defmodule Foo.Bar do
...

$ mix test

Compiling 1 file (.ex)
Generated foo app
error: module Foo is not loaded and could not be found
  test/foo_test.exs:3: FooTest (module)


== Compilation error in file test/foo_test.exs ==
** (CompileError) test/foo_test.exs: cannot compile module FooTest (errors have been logged)
    (ex_unit 1.15.7) expanding macro: ExUnit.DocTest.doctest/1
    test/foo_test.exs:3: FooTest (module)

mix compile --force does not help, it seems like i have to remove the module, compile and then re-add it to fix the error.

Expected behavior

To not have compilation errors when duplicate module duplicates gets resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions