Thank you for the clarification Ben. I am aware of that, I meant "duplicate at the AST level" in my proposal.
On Mon, 5 Apr 2021 09:07:55 -0700 (PDT) Ben Wilson <[email protected]> wrote: > Right, and this is why I think Jose is arguing that this is a job for > Dialyzer. The only way to know that two specs are duplicate is if > they are logically duplicate. Elixir does not know about the logic of > specs today, that's dialyzer's job. eg: > > @type one :: 1 > @spec foo(1) :: "one" > @spec foo(one) :: "one" > > This is logically duplicate, but not AST level duplicate. You could > special case things I suppose at the Elixir level and only care about > AST level duplicates but this leaves out a lot of cases people > probably care about: > > @spec age(user :: %User{}) :: integer > @spec age(current_user :: %User{}) :: integer > > Here we have specs that are basically duplicates, but there is a > difference in the argument name. > On Monday, April 5, 2021 at 9:53:47 AM UTC-4 eksperimental wrote: > > > On Mon, 5 Apr 2021 09:48:21 -0400 > > Allen Madsen <[email protected]> wrote: > > > > > @spec foo(1) :: "one" > > > @spec foo(2) :: "two" > > > def foo(1), do: "one" > > > def foo(2), do: "two" > > > > Yes, but those would not be duplicated. > > These would, and Dialyzer will error saying that "foo/1 has > > overlapping domains" > > > > @spec foo(1) :: "one" > > @spec foo(1) :: "one" > > @spec foo(2) :: "two" > > def foo(1), do: "one" > > def foo(2), do: "two" > > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/606b44d8.1c69fb81.68e7d.98fbSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
