exsync
exsync copied to clipboard
Fix elixir 1.19 compilation warnings
Fixes compilation warnings from using the struct update syntax (which now isn't as necessary because of type inference, although it can still be helpful to make the code more readable)
These were the compilation warnings:
warning: a struct for ExSync.SrcMonitor.State is expected on struct update:
%ExSync.SrcMonitor.State{state | throttle_timer: nil}
but got type:
dynamic()
where "state" was given the type:
# type: dynamic()
# from: lib/exsync/src_monitor.ex:61:45
state
when defining the variable "state", you must also pattern match on "%ExSync.SrcMonitor.State{}".
hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:
user = some_function()
%User{user | name: "John Doe"}
it is enough to write:
%User{} = user = some_function()
%{user | name: "John Doe"}
typing violation found at:
│
63 │ state = %State{state | throttle_timer: nil}
│ ~
│
└─ lib/exsync/src_monitor.ex:63:13: ExSync.SrcMonitor.handle_info/2
warning: a struct for ExSync.BeamMonitor.State is expected on struct update:
%ExSync.BeamMonitor.State{
state
| reload_set: MapSet.put(reload_set, module),
unload_set: MapSet.delete(unload_set, module)
}
but got type:
dynamic()
where "state" was given the type:
# type: dynamic()
# from: lib/exsync/beam_monitor.ex:99:52
state
when defining the variable "state", you must also pattern match on "%ExSync.BeamMonitor.State{}".
hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:
user = some_function()
%User{user | name: "John Doe"}
it is enough to write:
%User{} = user = some_function()
%{user | name: "John Doe"}
typing violation found at:
│
102 │ %State{
│ ~
│
└─ lib/exsync/beam_monitor.ex:102:5: ExSync.BeamMonitor.track_module_change/3
warning: a struct for ExSync.BeamMonitor.State is expected on struct update:
%ExSync.BeamMonitor.State{
state
| reload_set: MapSet.delete(reload_set, module),
unload_set: MapSet.put(unload_set, module)
}
but got type:
dynamic()
where "state" was given the type:
# type: dynamic()
# from: lib/exsync/beam_monitor.ex:109:52
state
when defining the variable "state", you must also pattern match on "%ExSync.BeamMonitor.State{}".
hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:
user = some_function()
%User{user | name: "John Doe"}
it is enough to write:
%User{} = user = some_function()
%{user | name: "John Doe"}
typing violation found at:
│
112 │ %State{
│ ~
│
└─ lib/exsync/beam_monitor.ex:112:5: ExSync.BeamMonitor.track_module_change/3