I am working on an Elixir library called
Tensor that allows manipulating Vectors/Matrices and higher dimension data grids (i.e. Tensors), which are implemented as a map of maps inside a struct.
All is fine, but ever so often, I suddenly get the following compilation error:
Compiling 4 files (.ex)
== Compilation error on file lib/matrix.ex ==
** (MatchError) no match of right hand side value: []
(elixir) src/elixir_locals.erl:34: :elixir_locals.local_for/4
This stack trace does not really tell me what is wrong. It seems that something goes wrong inside the file that does the compilation, rather than in the
Matrix module.
Now, when I remove the contents of matrix.ex and recompile, the project compiles, but I get some warning about missing module invocations in other parts of the code. This is completely reasonable and understandable behaviour.
Where it becomes strange is, that when I paste back the exact same contents into the matrix.ex file after this, and again recompile, everything works just fine!
So:
1. error on compilation.
2. Remove file contents, recompile.
3. Re-add file contents, recompile.
4. Problem fixed?
(when I try compiling later, the same problem will appear again)
This is a very curious behaviour, and I think it might hint at a bug.
Can someone explain what is going on?
Sincerely,
~Wiebe-Marten