-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
On Elixir 1.6.0, where statements with and or or operators cause compilation errors. The where macro works fine when they are not used, but when they are, for some reason elixir expands the match fields to functions (which don't exist), throwing a compilation error.
Environment Details:
- Elixir 1.6.0
- Erlang 20.1
- Amnesia 0.2.7 (Exquisite 0.1.7)
- MacOS High Sierra 10.13.2
Reproducing the Issue:
A simple elixir application with amnesia set up, along with this DB/Table. This would not compile on Elixir 1.6.0, but if you remove the find/2 method, it will.
use Amnesia
defdatabase DB do
deftable Post, [:user, :status, :content] do
# Insert a Post
def insert(user, status, content) do
Amnesia.transaction do
write(%DB.Post{user: user, status: status, content: content})
end
end
# Find all posts by user
def find(p_user) do
Amnesia.transaction do
where(user == p_user)
|> Amnesia.Selection.values
end
end
# Find all posts by user and status
def find(p_user, p_status) do
Amnesia.transaction do
where(user == p_user and status == p_status)
|> Amnesia.Selection.values
end
end
end
endError:
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Compiling 1 file (.ex)
warning: variable "user" does not exist and is being expanded to "user()", please use parentheses to remove the ambiguity or change the variable name
lib/amnesia.ex:26
warning: variable "status" does not exist and is being expanded to "status()", please use parentheses to remove the ambiguity or change the variable name
lib/amnesia.ex:26
== Compilation error in file lib/amnesia.ex ==
** (CompileError) lib/amnesia.ex:26: undefined function status/0
(stdlib) lists.erl:1338: :lists.foreach/2
lib/amnesia.ex:4: (module)
(elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6
Everything else works as expected. This is a serious bug which also affects one of my projects; Que. Hoping this gets resolved soon!
brandonparsons
Metadata
Metadata
Assignees
Labels
No labels