Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Created May 18, 2015 00:55
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 bjhaid/dbe99726476f5b2e2249 to your computer and use it in GitHub Desktop.
Save bjhaid/dbe99726476f5b2e2249 to your computer and use it in GitHub Desktop.
Compilation errors with bitstring spec
-module(test).
-compile([export_all]).
-spec foo(<<_:32, _:_*8>>) -> list.
foo(<<X:32, Y/binary>>) -> [X, Y].
defmodule Test do
@spec foo(<<_ :: 32, _ :: _ * 8>>) :: list
def foo(<<x :: 32, y :: binary>>), do: [x, y]
end
"""
$ elixirc test.exs
== Compilation error on file test.exs ==
** (CompileError) test.exs:2: type '*'(_,_) undefined
(stdlib) lists.erl:1336: :lists.foreach/2
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment