Closed eksperimental closed 3 years ago
Can you please post the full error message you get and stacktrace?
with assert_raise/2
$ TEST_FILES=protocol_test.exs make test_stdlib
==> elixir (ex_unit)
Excluding tags: [windows: true]
.......
1) test derives protocol explicitly (ProtocolTest)
test/elixir/protocol_test.exs:235
Got exception Protocol.UndefinedError but it failed to produce a message with:
** (Protocol.UndefinedError) protocol Inspect has no implementation for Any
(elixir 1.12.0-dev) Inspect.impl_for/1
(elixir 1.12.0-dev) lib/inspect.ex:6: Inspect.impl_for!/1
(elixir 1.12.0-dev) lib/inspect.ex:90: Inspect.inspect/2
(elixir 1.12.0-dev) lib/inspect/algebra.ex:311: Inspect.Algebra.to_doc/2
(elixir 1.12.0-dev) lib/kernel.ex:2190: Kernel.inspect/2
(elixir 1.12.0-dev) lib/exception.ex:1202: Protocol.UndefinedError.message/1
(ex_unit 1.12.0-dev) lib/ex_unit/assertions.ex:793: ExUnit.Assertions.check_error_message/2
(ex_unit 1.12.0-dev) lib/ex_unit/assertions.ex:774: ExUnit.Assertions.assert_raise/2
test/elixir/protocol_test.exs:239: ProtocolTest."test derives protocol explicitly"/1
(ex_unit 1.12.0-dev) lib/ex_unit/runner.ex:453: ExUnit.Runner.exec_test/1
(stdlib 3.13.2) timer.erl:166: :timer.tc/1
(ex_unit 1.12.0-dev) lib/ex_unit/runner.ex:404: anonymous fn/4 in ExUnit.Runner.spawn_test_monitor/4
code: assert_raise Protocol.UndefinedError, fn ->
stacktrace:
test/elixir/protocol_test.exs:239: (test)
..................
Finished in 1.3 seconds (0.9s on load, 0.4s on tests)
7 doctests, 19 tests, 1 failure
with assert_raise/2 commented out
$ TEST_FILES=protocol_test.exs make test_stdlib
==> elixir (ex_unit)
Excluding tags: [windows: true]
...........
02:07:38.181 [error] Failure while translating Erlang's logger event
** (Protocol.UndefinedError) protocol Inspect has no implementation for Any
(elixir 1.12.0-dev) Inspect.impl_for/1
(elixir 1.12.0-dev) lib/inspect.ex:6: Inspect.impl_for!/1
(elixir 1.12.0-dev) lib/inspect.ex:90: Inspect.inspect/2
(elixir 1.12.0-dev) lib/inspect/algebra.ex:311: Inspect.Algebra.to_doc/2
(elixir 1.12.0-dev) lib/inspect/algebra.ex:408: Inspect.Algebra.container_each/6
(elixir 1.12.0-dev) lib/inspect/algebra.ex:385: Inspect.Algebra.container_doc/6
(elixir 1.12.0-dev) lib/inspect/algebra.ex:408: Inspect.Algebra.container_each/6
(elixir 1.12.0-dev) lib/inspect/algebra.ex:385: Inspect.Algebra.container_doc/6
(elixir 1.12.0-dev) lib/kernel.ex:2190: Kernel.inspect/2
(logger 1.12.0-dev) lib/logger/translator.ex:201: Logger.Translator.report_gen_server_terminate/2
(logger 1.12.0-dev) lib/logger/handler.ex:228: Logger.Handler.do_translate/6
(logger 1.12.0-dev) lib/logger/handler.ex:133: Logger.Handler.do_log/4
(logger 1.12.0-dev) lib/logger/handler.ex:88: Logger.Handler.log/2
(kernel 7.1) logger_backend.erl:51: :logger_backend.call_handlers/3
(stdlib 3.13.2) gen_server.erl:934: :gen_server.error_info/7
(stdlib 3.13.2) gen_server.erl:914: :gen_server.terminate/10
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
make: *** [Makefile:286: test_stdlib] Error 1
Right, you are changing the behaviour of how protocols in the language work. You should expect breakages. :) The same way if you change +
to mean -
, then you will get a bunch of errors.
:facepalm:
Environment
Current behavior
I need to comment out the assert_raise to see what is going on. https://github.com/eksperimental/elixir/commit/a4bff623c913adca34ff92fdf4723864124b2b6e#diff-abbf4b34ea6ea77f855ad645e8f30ff24634df5e5eb2b5ffc46bc5e7c4f1dbe1R239
If you uncomment those lines, the test will fail leaving you clueless, beacuse the exception type matches.