Skip to content

Commit d1290d6

Browse files
ericmjJosé Valim
authored and
José Valim
committed
Fix struct/0 typespec
Closes #4915. Signed-off-by: José Valim <[email protected]>
1 parent 301aa6e commit d1290d6

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

lib/elixir/rebar.config

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{erl_opts, [
2-
warn_unused_vars,
3-
warn_export_all,
4-
warn_shadow_vars,
5-
warn_unused_import,
6-
warn_unused_function,
7-
warn_bif_clash,
8-
warn_unused_record,
9-
warn_deprecated_function,
10-
warn_obsolete_guard,
11-
strict_validation,
12-
warn_exported_vars,
13-
%% warn_export_vars,
14-
%% warn_missing_spec,
15-
%% warn_untyped_record,
16-
%% warnings_as_errors,
17-
debug_info
18-
]}.
2+
warn_unused_vars,
3+
warn_export_all,
4+
warn_shadow_vars,
5+
warn_unused_import,
6+
warn_unused_function,
7+
warn_bif_clash,
8+
warn_unused_record,
9+
warn_deprecated_function,
10+
warn_obsolete_guard,
11+
strict_validation,
12+
warn_exported_vars,
13+
%% warn_export_vars,
14+
%% warn_missing_spec,
15+
%% warn_untyped_record,
16+
%% warnings_as_errors,
17+
debug_info,
18+
{platform_define, "^18.*", old_map_specs}
19+
]}.
1920

2021
{yrl_opts, [
21-
{report, true},
22-
{verbose, false}
23-
]}.
22+
{report, true},
23+
{verbose, false}
24+
]}.

lib/elixir/src/elixir.erl

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
-export_type([charlist/0, char_list/0, struct/0, as_boolean/1, keyword/0, keyword/1]).
1515
-type charlist() :: string().
1616
-type char_list() :: string().
17-
-type struct() :: #{'__struct__' => atom()}.
1817
-type as_boolean(T) :: T.
1918
-type keyword() :: [{atom(), any()}].
2019
-type keyword(T) :: [{atom(), T}].
2120

21+
-ifdef(old_map_specs).
22+
-type struct() :: #{'__struct__' => atom(), atom() => any()}.
23+
-else.
24+
-type struct() :: #{'__struct__' := atom(), atom() => any()}.
25+
-endif.
26+
2227
%% OTP Application API
2328

2429
-export([start/2, stop/1, config_change/3]).

0 commit comments

Comments
 (0)