I have a macro that creates a module, a struct for the module, and implements a protocol for that struct.
In my suite I have a simple test module that calls the macro, and then makes assertions on the generated module/struct/protocol implementation. One test calls the protocol function with the struct to assert that it has been implemented. Prior to 1.2 this worked, but now it fails, and I get the following warning when running the suite.
test/dogma/rule_builder_test.exs:7: warning: the Dogma.Rule \
protocol has already been consolidated, an implementation for \
Dogma.RuleBuilderTest.MagicTestRule has no effect
I have removed this test for now, as I believe the rest of my suite tests this functionality sufficiently, but I'm curious if there is a way to make this work again, or at least silence the warning.
I played around with Process.consilodate/2
, but was unsuccessful.
Starting in Elixir 1.2, Mix consolidates protocols by default, which can cause the problem described here:
https://github.com/elixir-lang/elixir/blob/v1.2/CHANGELOG.md#workflow-improvements
It sounds to me like you have a different flavor of this same problem, but the fix is most likely the same. Set consolidate_protocols: false in your project config (only when running in the test environment).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With