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

Cannot call aliased module inside do block #19

Open
dylan-chong opened this issue Jan 9, 2018 · 1 comment
Open

Cannot call aliased module inside do block #19

dylan-chong opened this issue Jan 9, 2018 · 1 comment

Comments

@dylan-chong
Copy link

dylan-chong commented Jan 9, 2018


defmodule Mod do
  @lily_default_octave 1
  def default_octave, do: @lily_default_octave
end

  alias Mod, as: M
  test_with_params "bad", fn arg -> arg end do
    v = M.default_octave()
    [
      {v},
      {v + 1},
    ]
  end

** (Protocol.UndefinedError) protocol Enumerable not implemented for {:block, [], [{:=, [line: 132], [{:v, [line: 132], nil}, {{:., [line: 132], [{:aliases, [counter: 0, line: 132], [:M]}, :default_octave]}, [line: 132], []}]}, [{:{}, [line: 134], [{:v, [line: 134], nil}]}, {:{}, [line: 135], [{:+, [line: 135], [{:v, [line: 135], nil}, 1]}]}]]}. This protocol is implemented for: Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
(elixir) /private/tmp/elixir-20171219-79248-1tthq3/elixir-1.5.3/lib/elixir/lib/enum.ex:1: Enumerable.impl_for!/1
(elixir) /private/tmp/elixir-20171219-79248-1tthq3/elixir-1.5.3/lib/elixir/lib/enum.ex:145: Enumerable.count/1
(elixir) lib/enum.ex:500: Enum.count/1
lib/ex_parameterized/params.ex:54: ExUnit.Parameterized.Params.param_with_index/1
lib/ex_parameterized/params.ex:24: ExUnit.Parameterized.Params.do_test_with/3
expanding macro: ExUnit.Parameterized.Params.test_with_params/3
test/ex_composer_bot/pitch_test.exs:131: ExComposerBotTest.Pitch (module)
(elixir) lib/code.ex:376: Code.require_file/2
(elixir) lib/kernel/parallel_require.ex:59: anonymous fn/2 in Kernel.ParallelRequire.spawn_requires/5

@KazuCocoa
Copy link
Owner

KazuCocoa commented Jan 15, 2018

It looks same as #12 (comment) ...

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

No branches or pull requests

2 participants