Skip to content

Elixir 1.3.0 does not warn unused aliases, if the module contains an import #4871

@talklittle

Description

@talklittle

Environment

  • Elixir version (elixir -v): 1.3.0
  • Operating system: OS X 10.10.5

Current behavior

If a module has an unused alias, and also an import of any module, then the "unused alias" warning is not shown.

Example, add this to $ELIXIR_REPO/lib/elixir/test/elixir/kernel/warning_test.exs:

  test "unused alias when also import" do
    assert capture_err(fn ->
      Code.compile_string """
      defmodule Sample do
        alias :lists, as: List
        import HashSet
        def a, do: new()  # HashSet.new/0
      end
      """
    end) =~ "unused alias List"
  after
    purge Sample
  end

Expected behavior

The "unused alias" warning should still be shown. The presence of an unrelated import should not affect it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions