Ecto failing to compile on Elixir 1.6.0-dev

So I tried running in dev on Elixir 1.6.0 (formatting some files of my big big projects) and… it will not compile. I’ve mix deps.clean --all'd and mix clean and even a fresh git clone and it always fails with this same error:

╰─➤  mix compile
==> ecto
Compiling 70 files (.ex)
warning: function slice/1 required by protocol Enumerable is not implemented (in module Enumerable.Ecto.Adapters.SQL.Stream)
  lib/ecto/adapters/sql/stream.ex:12


== Compilation error in file lib/ecto/adapters/postgres/connection.ex ==
** (ArgumentError) argument error
    (stdlib) erl_anno.erl:322: :erl_anno.set(:generated, false, {"lib/ecto/adapters/postgres/datetime.ex", 48})
could not compile dependency :ecto, "mix compile" failed. You can recompile this dependency with "mix deps.compile ecto", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"

That line 48 in that datetime.ex file is just:

<<4 :: int32, days :: int32>> ->

Inside of this function:

    def decode(_) do
      quote location: :keep do
        <<4 :: int32, days :: int32>> ->
          :calendar.gregorian_days_to_date(days + unquote(@gd_epoch))
      end
    end
  end

I’ve tried updating ecto (latest of 2.2), etc…

So… what on earth did I break?! o.O?

I’ve reverted back to 1.5.2 again for now but still, the heck did I do?! O.o?

Some more testing, it broke sometime between (but not including) commit f36a0f4 and HEAD.

Are you using an OTP version compatible with Elixir 1.6? 1.6 only supports OTP19+.

Some more testing, it broke sometime between (but not including) commit f36a0f4 and HEAD.

I can’t find commit f36a0f4 and the datetime.ex file doesn’t exist in HEAD.

╰─➤  iex
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.6.0-dev) - press Ctrl+C to exit (type h() ENTER for help)

So, yes. :slight_smile:

I can’t find commit f36a0f4 and the datetime.ex file doesn’t exist in HEAD.

I meant commit f36a0f4 of Elixir’s main language github, happened about a week ago (it was another build I had ready so I just had to link to it to test, and yes I entirely clean out all beam files every time). I’ve not tried Ecto HEAD yet, only Ecto 2.2 latest published. Is the issue fixed in Ecto master? I’d prefer not to link to non-published versions of dependencies in this main project when all I was planning to do was just mix format various things. ^.^;

EDIT: The ecto entry in the mix.lock file is:

  "ecto": {:hex, :ecto, "2.2.6", "3fd1067661d6d64851a0d4db9acd9e884c00d2d1aa41cc09da687226cf894661", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},

The file you get the error from doesn’t exist on Elixir master.

I can reproduce when using Ecto 2.2.6 on Elixir master, it seems to be an issue when using macros inside binary literals. Please open an issue on Elixir.

2 Likes

Ah cool, I was worried I borked something hard somewhere… ^.^;

Issue opened and linked here:

1 Like