--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/147aa05a-be3d-4f32-aab8-13a1938341b0n%40googlegroups.com.
Even if string literals were allowed, the proposed spec wouldn’t be accepted by dialyzer. Dialyzer does not support overloaded specs with overlapping arguments. In this case “account_created” is a subtype of String.t(), so the spec would be rejected.
You can see by having a similar spec using atoms:
-spec to_struct
(account_created) -> {account_created};
(account_cloded) -> {account_closed};
(atom()) -> no_return().
Produces the following diagnostic from dialyzer:
test.erl:5:2: Overloaded contract for test:to_struct/1 has overlapping domains; such contracts are currently unsupported and are simply ignored
Michał.
--