Open DaTrader opened 2 years ago
The following code does not compile (Elixir 1.13.4) unless the @spec is removed:
import ProtocolEx defprotocol_ex JsonDecodable do @spec decode( term()) :: { :ok, term()} | { :error, any()} def decode( json_decodable) end
The compiler error:
== Compilation error in file lib/json_decoder/json_decodable.ex == ** (ProtocolEx.InvalidProtocolSpecification) Unhandled specification node: {:@, [line: 4], [{:spec, [line: 4], [{:"::", [line: 4], [{:decode, [line: 4], [{:term, [line: 4], []}]}, {:|, [line: 4], [{:ok, {:term, [line: 4], []}}, nil]}]}]}]} (protocol_ex 0.4.4) lib/protocol_ex.ex:618: ProtocolEx.decompose_spec_element/4 (protocol_ex 0.4.4) lib/protocol_ex.ex:548: ProtocolEx.decompose_spec/4 (protocol_ex 0.4.4) expanding macro: ProtocolEx.defprotocolEx/3 lib/json_decoder/json_decodable.ex:3: (file) (protocol_ex 0.4.4) expanding macro: ProtocolEx.defprotocol_ex/2 lib/json_decoder/json_decodable.ex:3: (file)
Hrmm, yeah I never took into account spec nodes either... PR is welcome? Or I'll get to it next time I do an update on my internal systems... :-)
The following code does not compile (Elixir 1.13.4) unless the @spec is removed:
The compiler error: