bitwalker / bitwalker/timex

Elixir 1.19 compiler issues struct update warnings when compiling the library

Open
#785 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Elixir
Stars
1.8k
Forks
407
PR merge metrics
No merged PRs in 30d

Description

The following are warnings issued by the compiler on Elixir 1.19.5:

```
warning: a struct for Timex.PosixTimezone is expected on struct update:

%Timex.PosixTimezone{rule | std_abbr: abbr}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/posix/parser.ex:119:33
rule

when defining the variable "rule", you must also pattern match on "%Timex.PosixTimezone{}".

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:

121 │ parse_tz(:std_offset, rest, %TZ{rule | std_abbr: abbr})
│ ~

└─ (timex 3.7.13) lib/parse/posix/parser.ex:121:35: Timex.Parse.Timezones.Posix.parse_tz/3

warning: a struct for Timex.PosixTimezone is expected on struct update:

%Timex.PosixTimezone{rule | std_offset: offset}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/posix/parser.ex:125:35
rule

when defining the variable "rule", you must also pattern match on "%Timex.PosixTimezone{}".

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:

127 │ parse_tz(:dst_abbr, rest, %TZ{rule | std_offset: offset})
│ ~

└─ (timex 3.7.13) lib/parse/posix/parser.ex:127:33: Timex.Parse.Timezones.Posix.parse_tz/3

warning: a struct for Timex.PosixTimezone is expected on struct update:

%Timex.PosixTimezone{rule | dst_abbr: abbr}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/posix/parser.ex:141:33
rule

when defining the variable "rule", you must also pattern match on "%Timex.PosixTimezone{}".

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:

143 │ rule = %TZ{rule | dst_abbr: abbr} do
│ ~

└─ (timex 3.7.13) lib/parse/posix/parser.ex:143:17: Timex.Parse.Timezones.Posix.parse_tz/3

warning: a struct for Timex.PosixTimezone is expected on struct update:

%Timex.PosixTimezone{rule | dst_offset: offset}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/posix/parser.ex:160:35
rule

when defining the variable "rule", you must also pattern match on "%Timex.PosixTimezone{}".

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:

162 │ rule = %TZ{rule | dst_offset: offset} do
│ ~

└─ (timex 3.7.13) lib/parse/posix/parser.ex:162:17: Timex.Parse.Timezones.Posix.parse_tz/3

warning: a struct for Timex.PosixTimezone is expected on struct update:

%Timex.PosixTimezone{rule | dst_start: dst_start, dst_end: dst_end}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/posix/parser.ex:185:36
rule

when defining the variable "rule", you must also pattern match on "%Timex.PosixTimezone{}".

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:

190 │ {:ok, %TZ{rule | dst_start: dst_start, dst_end: dst_end}, rest}
│ ~

└─ (timex 3.7.13) lib/parse/posix/parser.ex:190:17: Timex.Parse.Timezones.Posix.parse_tz/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | transitions: transitions, leaps: leaps}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:156:28
{:ok, zone, rest} <- parse_content(1, data, %Timex.Parse.ZoneInfo.Parser.Zone{..., version: 1})

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

159 │ {:ok, %Zone{zone | transitions: transitions, leaps: leaps}, rest}
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:159:13: Timex.Parse.ZoneInfo.Parser.parse_versioned_content/2

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | transitions: times}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:270:92
zone

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

272 │ parse_transition_info(version, rest, header, %Zone{zone | transitions: times})
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:272:50: Timex.Parse.ZoneInfo.Parser.parse_transition_times/4

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | leaps: leaps}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:330:79
zone

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

344 │ parse_flags(version, rest, header, %Zone{zone | leaps: leaps})
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:344:40: Timex.Parse.ZoneInfo.Parser.parse_leap_seconds/4

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | transitions: transitions}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:348:90
zone

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

362 │ parse_posixtz_string(version, rest, %Zone{zone | transitions: transitions})
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:362:43: Timex.Parse.ZoneInfo.Parser.parse_flags/4

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | transitions: transitions}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:348:90
zone

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

364 │ {:ok, %Zone{zone | transitions: transitions}, rest}
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:364:13: Timex.Parse.ZoneInfo.Parser.parse_flags/4

warning: a struct for Timex.Parse.ZoneInfo.Parser.Zone is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Zone{zone | rule: rule}

but got type:

dynamic()

where "zone" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:369:62
zone

when defining the variable "zone", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Zone{}".

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:

372 │ {:ok, %Zone{zone | rule: rule}, format_rest <> rest}
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:372:13: Timex.Parse.ZoneInfo.Parser.parse_posixtz_string/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Rule is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Rule{rule | std_abbr: abbr, dst_abbr: abbr}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:383:33
rule

when defining the variable "rule", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Rule{}".

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:

385 │ parse_tz(:std_offset, rest, %Rule{rule | std_abbr: abbr, dst_abbr: abbr})
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:385:35: Timex.Parse.ZoneInfo.Parser.parse_tz/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Rule is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Rule{rule | std_offset: offset, dst_offset: offset}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:389:35
rule

when defining the variable "rule", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Rule{}".

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:

391 │ parse_tz(:dst_abbr, rest, %Rule{rule | std_offset: offset, dst_offset: offset})
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:391:33: Timex.Parse.ZoneInfo.Parser.parse_tz/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Rule is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Rule{rule | dst_abbr: abbr}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:405:33
rule

when defining the variable "rule", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Rule{}".

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:

407 │ rule = %Rule{rule | dst_abbr: abbr} do
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:407:17: Timex.Parse.ZoneInfo.Parser.parse_tz/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Rule is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Rule{rule | dst_offset: offset}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:424:35
rule

when defining the variable "rule", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Rule{}".

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:

426 │ rule = %Rule{rule | dst_offset: offset} do
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:426:17: Timex.Parse.ZoneInfo.Parser.parse_tz/3

warning: a struct for Timex.Parse.ZoneInfo.Parser.Rule is expected on struct update:

%Timex.Parse.ZoneInfo.Parser.Rule{rule | start_time: start_time, end_time: end_time}

but got type:

dynamic()

where "rule" was given the type:

# type: dynamic()
# from: lib/parse/zoneinfo/parser.ex:449:36
rule

when defining the variable "rule", you must also pattern match on "%Timex.Parse.ZoneInfo.Parser.Rule{}".

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:

454 │ {:ok, %Rule{rule | start_time: start_time, end_time: end_time}, rest}
│ ~

└─ (timex 3.7.13) lib/parse/zoneinfo/parser.ex:454:17: Timex.Parse.ZoneInfo.Parser.parse_tz/3
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.