Skip to content

Commit cd5e3b6

Browse files
tests: OTP-27 compatible
Summary: - The type `file:fd()` has changed between OTP 26 and OTP 27 - erlang/otp@218ecbe#diff-7f2ad64a34b87080776f94ed42c8f0de5232c9e0d2db74c8e5e48fa2bf4963cb, which now results into different error messages on different OTP versions - massaging the tests to not use the type `file:fd()` directly, - this relies a bit on how much eqwalizer unfolds when reporting a subtype error, but this is the best we can do right now to preserve the tests and to run them the same way both on OTP 26 and OTP 27 Reviewed By: michalmuskala Differential Revision: D59757111 fbshipit-source-id: 70ac1be599ee21e824618833ab883c7f25563bf0
1 parent ffad3c7 commit cd5e3b6

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

crates/elp/src/resources/test/eqwalizer_tests/check/custom.pretty

+4-8
Original file line numberDiff line numberDiff line change
@@ -2214,14 +2214,12 @@ error: incompatible_types
22142214
│ │
22152215
│ Device.
22162216
Expression has type: file:io_device()
2217-
Context expected type: file:fd()
2217+
Context expected type: #file_descriptor{}
22182218

22192219
See https://fb.me/eqwalizer_errors#incompatible_types
22202220
22212221

2222-
file:io_device() is not compatible with file:fd()
2223-
because
2224-
pid() | file:fd() is not compatible with file:fd()
2222+
file:io_device() is not compatible with #file_descriptor{}
22252223
because
22262224
pid() | file:fd() is not compatible with #file_descriptor{}
22272225
because
@@ -2235,14 +2233,12 @@ error: incompatible_types
22352233
│ │
22362234
│ Device.
22372235
Expression has type: file:io_device()
2238-
Context expected type: file:fd()
2236+
Context expected type: #file_descriptor{}
22392237

22402238
See https://fb.me/eqwalizer_errors#incompatible_types
22412239
22422240

2243-
file:io_device() is not compatible with file:fd()
2244-
because
2245-
pid() | file:fd() is not compatible with file:fd()
2241+
file:io_device() is not compatible with #file_descriptor{}
22462242
because
22472243
pid() | file:fd() is not compatible with #file_descriptor{}
22482244
because

test_projects/eqwalizer_tests/check/src/custom.erl

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
-import(maps, [get/2, get/3]).
99
-compile([export_all, nowarn_export_all]).
10-
10+
-include_lib("kernel/include/file.hrl").
1111
-record(foo, {
1212
a :: ok | error,
1313
b :: number(),
@@ -2158,21 +2158,21 @@ file_open1() ->
21582158
file:open("/file", [read]),
21592159
Device.
21602160

2161-
-spec file_open2() -> file:fd().
2161+
-spec file_open2() -> #file_descriptor{}.
21622162
file_open2() ->
21632163
{ok, Device} =
21642164
file:open("/file", [read, raw]),
21652165
Device.
21662166

21672167
-spec file_open3_neg
2168-
([file:mode()]) -> file:fd().
2168+
([file:mode()]) -> #file_descriptor{}.
21692169
file_open3_neg(Modes) ->
21702170
{ok, Device} =
21712171
file:open("/file", Modes),
21722172
Device.
21732173

21742174
-spec file_open5_neg
2175-
(file:mode()) -> file:fd().
2175+
(file:mode()) -> #file_descriptor{}.
21762176
file_open5_neg(Mode) ->
21772177
{ok, Device} =
21782178
file:open("/file", [Mode]),

0 commit comments

Comments
 (0)