Browse files

Fix dialyzer warnings.

Fixed:
pokemon_pb.erl:52: The pattern <Default, _> can never match since previous clauses completely covered the type <_,'none'>
pokemon_pb.erl:53: The pattern <Val, _> can never match since previous clauses completely covered the type <_,'none'>
protobuffs.erl:373: Invalid type specification for function protobuffs:encode_field_tag/2. The success typing is (non_neg_integer(),0 | 1 | 2 | 5) -> [integer(),...]
protobuffs.erl:387: Invalid type specification for function protobuffs:encode_varint/1. The success typing is (integer()) -> [integer(),...]
protobuffs.erl:393: Invalid type specification for function protobuffs:encode_varint/2. The success typing is (integer(),[integer()]) -> [integer(),...]

Safe to ignore:
pokemon_pb.erl:46: The variable _ can never match since previous clauses completely covered the type #pikachu{}
  • Loading branch information...
1 parent d732191 commit 7c3612c9bdb408aee3cfb7dbba11a8262d5bcac7 @seancribbs seancribbs committed Mar 7, 2013
Showing with 4 additions and 5 deletions.
  1. +0 −1 src/pokemon_pb.erl
  2. +4 −4 src/protobuffs.erl
View
1 src/pokemon_pb.erl
@@ -48,7 +48,6 @@ encode_extensions(_) -> [].
iolist(pikachu, Record) ->
[pack(1, required, with_default(Record#pikachu.abc, none), string, [])].
-with_default(Val, none) -> Val;
with_default(Default, Default) -> undefined;
with_default(Val, _) -> Val.
View
8 src/protobuffs.erl
@@ -26,7 +26,7 @@
%% @doc A protcol buffers encoding and decoding module.
-module(protobuffs).
-%% Pubic
+%% Public
-export([encode/3, encode_packed/3, decode/2, decode_packed/2]).
%% Used by generated *_pb file. Not intended to used by User
@@ -372,7 +372,7 @@ typecast(Value, _) ->
%% @hidden
-spec encode_field_tag(FieldID :: non_neg_integer(),
FieldType :: encoded_field_type()) ->
- binary().
+ iodata().
encode_field_tag(FieldID, FieldType) when FieldID band 16#3fffffff =:= FieldID ->
encode_varint((FieldID bsl 3) bor FieldType).
@@ -385,13 +385,13 @@ encode_varint_field(FieldID, Integer) ->
%% @hidden
-spec encode_varint(I :: integer()) ->
- binary().
+ iodata().
encode_varint(I) ->
encode_varint(I, []).
%% @hidden
-spec encode_varint(I :: integer(), Acc :: list()) ->
- binary().
+ iodata().
encode_varint(I, Acc) when I =< 16#7f ->
lists:reverse([I | Acc]);
encode_varint(I, Acc) ->

0 comments on commit 7c3612c

Please sign in to comment.