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
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
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









