Skip to content

Instantly share code, notes, and snippets.

@orendon
Created June 25, 2015 16:46
Show Gist options
  • Save orendon/251a9fe334e5a8d285ee to your computer and use it in GitHub Desktop.
Save orendon/251a9fe334e5a8d285ee to your computer and use it in GitHub Desktop.
default conflicts error on Elixir 1.0.4
defmodule CheckDefaults do
def foo(a, b, c \\ 0) do
a+b+c
end
def foo(a, b, c, d \\ 0) do
a+b+c+d
end
end
iex:13: warning: redefining module CheckDefaults
** (CompileError) iex:17: def foo/4 defaults conflicts with def foo/3
(elixir) src/elixir_def.erl:373: :elixir_def."-check_previous_defaults/7-lc$^0/1-0-"/7
(elixir) src/elixir_def.erl:89: :elixir_def.store_definition/9
(elixir) src/elixir_compiler.erl:126: :elixir_compiler.dispatch_loaded/6
(elixir) src/elixir_module.erl:141: :elixir_module.eval_form/6
(elixir) src/elixir_module.erl:57: :elixir_module.do_compile/5
(elixir) src/elixir_lexical.erl:16: :elixir_lexical.run/3
@taylorbrooks
Copy link

@orendon I found this in a Google search. Did you ever get it resolved?

I have a similar problem:

 def all(params, api_key \\ :global) do                        
   get(@url_part, api_key, params)                             
 end                                                           

 def all(:paginate, params, api_key \\ :global) do             
   ResultStream.new(params, api_key, @url_part) |> Enum.to_list
 end

** (CompileError) lib/ex_closeio/resources/lead.ex:10: def all/3 defaults conflicts with def all/2

@7rajatgupta
Copy link

Even I'm getting the same error !! How to fix this ?

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