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

last import Mod, only: [...] for same module hides functions imported before #10448

Closed
marianoguerra opened this issue Oct 20, 2020 · 0 comments

Comments

@marianoguerra
Copy link

Precheck

  • Do not use the issue tracker for help or support (try Elixir Forum, Stack Overflow, IRC, etc.)
  • For proposing a new feature, please start a discussion on the Elixir Core mailing list: https://groups.google.com/group/elixir-lang-core
  • For bugs, do a quick search and make sure the bug has not yet been reported
  • Please disclose security vulnerabilities privately at elixir-security@googlegroups.com
  • Finally, be nice and have fun!

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Elixir 1.10.4 (compiled with Erlang/OTP 23)
  • Operating system: Ubuntu 20.04

Current behavior

The following module fails to compile with error mymod.ex:6: undefined function sum/1:

defmodule MyMod do
  import :lists, only: [sum: 1]
  import :lists, only: [reverse: 1]

  def fun() do
    sum(reverse([]))
  end
end

if import order is reversed it fails with error mymod.ex:6: undefined function reverse/1, if both functions are imported in the same import expression then it works.

Expected behavior

a warning and maybe a note in the docs if it's the expected behavior or to compile in case it's not the intended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant