Skip to content

Commit 0da7623

Browse files
committed
add support for OPT 25 dialyzer opts
1 parent 5af6a3f commit 0da7623

File tree

1 file changed

+20
-2
lines changed
  • apps/language_server/lib/language_server/dialyzer

1 file changed

+20
-2
lines changed

apps/language_server/lib/language_server/dialyzer/analyzer.ex

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
defmodule ElixirLS.LanguageServer.Dialyzer.Analyzer do
22
require Record
33

4-
# :warn_race_condition is unsupported because it greatly increases analysis time
4+
# warn_race_condition is unsupported because it greatly increases analysis time
5+
# OTP 25 dropped support for warn_race_condition
6+
# see https://github.com/erlang/otp/commit/74c65fbb588b98ee24df9f7302a43552178dfac2
7+
# TODO remove this comment when OTP >= 25 is required
8+
9+
# default warns taken from
10+
# https://github.com/erlang/otp/blob/4ed7957623e5ccbd420a09a506bd6bc9930fe93c/lib/dialyzer/src/dialyzer_options.erl#L34
11+
# macros defined in https://github.com/erlang/otp/blob/4ed7957623e5ccbd420a09a506bd6bc9930fe93c/lib/dialyzer/src/dialyzer.hrl#L36
12+
# as of OTP 25
513
@default_warns [
614
:warn_behaviour,
715
:warn_bin_construction,
@@ -26,7 +34,17 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Analyzer do
2634
:warn_return_only_exit,
2735
:warn_umatched_return,
2836
:warn_unknown
29-
]
37+
] ++ (
38+
if String.to_integer(System.otp_release()) >= 25 do
39+
[
40+
# OTP >= 25 options
41+
:warn_contract_missing_return,
42+
:warn_contract_extra_return
43+
]
44+
else
45+
[]
46+
end
47+
)
3048
@log_cache_length 10
3149

3250
defstruct [

0 commit comments

Comments
 (0)