[erlang-questions] 12B4 dialyzer problem 5

Anthony Shipman als@REDACTED
Wed Sep 17 16:23:23 CEST 2008


I had a -spec that read

-spec getHandlerModule(string()) -> {ok, Module::atom(), StrmID::integer} | 
error.

This caused code like

    case getHandlerModule(HName) of
    {ok, Mod, DefaultID} ->
	OptionMeta = Mod:optionMetadata(),
	checkForm(Sess, Arg, OptionMeta, createStream4(DefaultID, HName));
    error ->
	returnError(text:get(invalidHandlerForm))
    end.

to result in the dialyzer message
    The pattern {'ok', Mod, DefaultID} can never match the type 'error'

I can see where my typo is but I can't relate it the error message. I would 
expect that the pattern will always match and I'd get a type error further 
down-stream.
-- 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.



More information about the erlang-questions mailing list