You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a function in my demo app which I have spec'd to take any atom, and a branch which checks if it's in a subset of terms to create my struct, otherwise it will raise an ArgumentError. But this won't type check I'm assuming for similar reasons as my previous issue... But for reference, here's the snippet I changed to a stack of or's cause I thought it might have to do with st in [:a, :b, :c, :d, :etc] but same error either way.
@spec new!(atom()) :: t() | no_return()
def new!(st) do
if st == :oregon or
st == :washington or
st == :colorado or
st == :tennessee or
st == :new_york do
%__MODULE__{_: st}
else
raise(ArgumentError, "Unrecognized state")
end
end
errors with
❌ St.new!/1
|
| type `%St{_: atom()}` not match with union type `%St{_: :washington | :tennessee | :oregon | :new_york | :colorado}`
|
| at unknown_file:?
The text was updated successfully, but these errors were encountered:
I've got a function in my demo app which I have spec'd to take any atom, and a branch which checks if it's in a subset of terms to create my struct, otherwise it will raise an ArgumentError. But this won't type check I'm assuming for similar reasons as my previous issue... But for reference, here's the snippet I changed to a stack of
or
's cause I thought it might have to do withst in [:a, :b, :c, :d, :etc]
but same error either way.errors with
The text was updated successfully, but these errors were encountered: