tjchambers

tjchambers

Missing compilations on 1.20.0 rc.3

Erlang OTP 28
Elixir 1.20.0-rc.3 (9b80ab5) (compiled with Erlang/OTP 28)

I am having a difficult to fathom issue with developing on 1.20.0-rc.3. Yesterday I switched from 1.19.4 to developing on that version and all seemed to be fine. Everything recompiled and tests all passed.

Today I added a field to an Ecto schema for a module - for the purposes of this issue the name appears to not be relevant so I called it xx

```

 field(:xx, :string)
``

After I did that I did a mix compile and got dozens of errors. The errors all referred to the structure in my schema, and the struct breakdown in the errors did NOT include that added field in the field list. The references in the warnings all looked odd (the references in the structure to a title of type :string displayed like they were a :map sometimes).

If I removed the newly added field and did a mix compile again then I got no errors.

Adding it back again caused all the type warning errors everywhere I referenced this structure. Mind you I did nothing other than add that one line - I expected NO warnings/errors.

Then I tried doing a mix compile –force

ALL my errors were now gone!!!

So I tried removing the newly added field. Did a mix compile and all my errors came back. Interestingly the type warnings included the field I had just removed in the structure breakdown in the error output - but I had just REMOVED IT! So how was it displaying a field in the list that did not exist in the source?

So I did a mix compile –force and like before all my type warnings disappeared.

My inference from the above is two-fold under 1.20.0-rc.3:

  • Mix compile may not be compiling all of the code it should be under rc.3 (yes - it is very fast, but perhaps incomplete).
  • When it fails to compile everything and then type checking occurs, the type checking is comparing a PRIOR version of my structure to the current version and finding the structs do not match.

I have not taken the time to create a simplified example of this, but this appears to be quite serious if my inferences (or some variation on them) is accurate.

This seems on the surface easy to reproduce - assuming a structure reference in a parameter to a function which is where all the type warnings originated.

First Post!

tjchambers

tjchambers

 warning: incompatible types given to pick_items_needing_reviewed/2:

        pick_items_needing_reviewed(cd, participant)

    given types:

        (
          dynamic(%Sct.Solve.CollaborativeDesign{}),
          dynamic(
            %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: nil or boolean()}} or nil or
              (%Sct.Align.Participant{active: true} and
                 not (%Sct.Align.Participant{person: %Sct.Network.Person{is_user?: false}} or
                        %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: nil}} or
                        %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: true}}))
          )
        )

    but expected one of:

        (
          %Sct.Perform.Fd{active: true} or %Sct.Perform.RoadMap{active: true} or
            %Sct.Perform.TopicScorecard{active: true} or
            %{
              __meta__: term(),
              __struct__: Sct.Solve.CollaborativeDesign,
              active: true,
              cd_details: term(),
              created_at: term(),
              description: term(),
              id: term(),
              issues: term(),
              pds: term(),
              permalink: term(),
              published_state: term(),
              restricted?: term(),
              solutions: term(),
              strategic_collaboration: term(),
              strategic_collaboration_id: term(),
              tasks: term(),
              theme: term(),
              theme_id: term(),
              title: term(),
              type: term(),
              updated_at: term(),
              xx: term()
            },
          term()
        )

    where "cd" was given the type:

        # type: dynamic(%Sct.Solve.CollaborativeDesign{})
        # from: lib/sct/misc/changebars.ex:55:41
        %Sct.Solve.CollaborativeDesign{} = cd

    where "participant" was given the type:

        # type: dynamic(
          %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: nil or boolean()}} or nil or
            (%Sct.Align.Participant{active: true} and
               not (%Sct.Align.Participant{person: %Sct.Network.Person{is_user?: false}} or
                      %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: nil}} or
                      %Sct.Align.Participant{person: %Sct.Network.Person{is_user?: true}}))
        )
        # from: lib/sct/misc/changebars.ex:56:8
        show_changebars?(participant)

    type warning found at:
    │
 57 │       pick_items_needing_reviewed(cd, participant)
    │       ~
    │
    └─ lib/sct/misc/changebars.ex:57:7: Sct.Changebars.changebars/2

Above is one of the warnings AFTER I removed xx from the schema. Note xx appears in the breakdown of the schema - even as it has been removed. Also note that the breakdown appears like a map format with the internal __struct__ reference as expected.

Most Liked

josevalim

josevalim

Creator of Elixir

It is a bug indeed, it will be fixed shortly.

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement