Skip to content

Instantly share code, notes, and snippets.

@josevalim

josevalim/bash Secret

Created February 6, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/77ba585445e2eccb5160 to your computer and use it in GitHub Desktop.
Save josevalim/77ba585445e2eccb5160 to your computer and use it in GitHub Desktop.
$ erlc foo.erl
foo: function decode/1+28:
Internal consistency check failed - please report this bug.
Instruction: return
Error: {match_context,{x,0}}:
-module(foo).
-export([decode/1]).
decode(<<Code/integer, Bin/binary>>) ->
<<C1/integer, B1/binary>> = Bin,
case C1 of
X when X =:= 1 orelse X =:= 2 ->
Bin2 = <<>>;
_ ->
Bin2 = B1
end,
case Code of
1 -> decode(Bin2);
_ -> Bin2
end.
@kostis
Copy link

kostis commented Feb 6, 2016

If there's any help, the consistency check error disappears if

  • either the orelse is substituted with ;
  • or if the Bin2 = assignment is factored out outside the case statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment