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

ProtcolEx implementation fails to compile with @spec #66

Open
DaTrader opened this issue Aug 27, 2022 · 1 comment
Open

ProtcolEx implementation fails to compile with @spec #66

DaTrader opened this issue Aug 27, 2022 · 1 comment

Comments

@DaTrader
Copy link

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)
@OvermindDL1
Copy link
Owner

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... :-)

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