Skip to content

Commit

Permalink
fix more dialyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vinoski committed Mar 1, 2011
1 parent 1fcdfd7 commit b6ffe23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/haxe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ scan_chars(Chars, Type) ->
Other
end.

scan_chars(eof, A, _NumLeft) ->
scan_chars([eof|_], A, _NumLeft) ->
{done, {error, premature_eof}, A};
scan_chars(Rest, A, 0) ->
{done, {ok, lists:reverse(A)}, Rest};
Expand Down
8 changes: 0 additions & 8 deletions src/yaws_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,6 @@ fload(FD, ssl, GC, C, Cs, Lno, Chars) ->
Err
end;

fload(FD, rss, _GC, _C, _Cs, Lno, eof) ->
file:close(FD),
{error, ?F("Unexpected end of file at line ~w", [Lno])};

fload(FD, rss, GC, C, Cs, Lno, Chars) ->
%%?Debug("Chars: ~s", [Chars]),
Next = io:get_line(FD, ''),
Expand Down Expand Up @@ -1245,10 +1241,6 @@ fload(FD, rss, GC, C, Cs, Lno, Chars) ->
Err
end;

fload(FD, opaque, _GC, _C, _Cs, Lno, eof) ->
file:close(FD),
{error, ?F("Unexpected end of file at line ~w", [Lno])};

fload(FD, opaque, GC, C, Cs, Lno, Chars) ->
%%?Debug("Chars: ~s", [Chars]),
Next = io:get_line(FD, ''),
Expand Down

3 comments on commit b6ffe23

@kostis
Copy link

@kostis kostis commented on b6ffe23 Mar 2, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether the change in haxe's code is the right one. I think that dialyzer is complaining that the scan_chars(eof, A, _NumLeft) clause is unreachable, not because its first argument is not wrapped in a list, but because the 'eof' atom has already been consumed in functions token_vsn1/1 and token_vsn2/1 functions which trigger the calls to scan_chars/3.

Anyway, you probably want to check that. I think the clause can simply be removed.

@kostis
Copy link

@kostis kostis commented on b6ffe23 Mar 2, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing: while you check that, can you please also remove the confusing empty line in the middle of scan_chars/3's clauses?

@vinoski
Copy link
Collaborator Author

@vinoski vinoski commented on b6ffe23 Mar 2, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks like the other scan_* functions are handling eof and so it can never reach the scan_chars function. Fixed in f0c19f.

Please sign in to comment.