sasa1977 / boundary

Manage and restrain cross-module dependencies in Elixir projects
MIT License
818 stars 21 forks source link

Reference not removed in submodule even though it no longer exists in the code #37

Closed ppraisethesun closed 2 years ago

ppraisethesun commented 2 years ago

Code before:

defmodule A do
  use Boundary, deps: [], exports: []
end

defmodule A.Dep do
  def run do
    B.run()
  end
end

defmodule B do
  use Boundary, deps: [], exports: []

  def run do
    IO.inspect(__MODULE__)
  end
end

mix compile output:

warning: forbidden reference to B
  (references from A to B are not allowed)
  lib/a/dep.ex:3

Code after:

defmodule A do
  use Boundary, deps: [], exports: []
end

defmodule A.Dep do
  def run do
    # removed reference to B
  end
end

defmodule B do
  use Boundary, deps: [], exports: []

  def run do
    IO.inspect(__MODULE__)
  end
end

Expected behaviour: Project compiles without warnings

Actual behaviour:

Compiling 1 file (.ex)

warning: forbidden reference to B
  (references from A to B are not allowed)
  lib/a/dep.ex:3

Warning only disappears after running mix clean

sasa1977 commented 2 years ago

Thanks for the report. I've pushed a candidate fix to the fix-recompile-behaviour branch. Could you please give it a try locally?