Skip to content

Commit dbfc3fa

Browse files
committed
Get domain upper bounds
1 parent dd6b660 commit dbfc3fa

3 files changed

Lines changed: 19 additions & 22 deletions

File tree

lib/elixir/test/elixir/enum_test.exs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,10 +1885,6 @@ defmodule EnumTest.Range do
18851885
assert Enum.drop_every(1..5//2, 0) == [1, 3, 5]
18861886
assert Enum.drop_every(1..5//2, 1) == []
18871887
assert Enum.drop_every(1..5//2, 2) == [3]
1888-
1889-
assert_raise FunctionClauseError, fn ->
1890-
Enum.drop_every(1..10, 3.33)
1891-
end
18921888
end
18931889

18941890
test "drop_while/2" do

lib/elixir/test/elixir/module/types/infer_test.exs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ defmodule Module.Types.InferTest do
3939
end
4040

4141
args = [
42-
dynamic(open_map(__struct__: atom([Point]))),
43-
dynamic(open_map(__struct__: atom([Point]))),
44-
dynamic(atom([Point])),
45-
dynamic(atom([Point]))
42+
open_map(__struct__: atom([Point])),
43+
open_map(__struct__: atom([Point])),
44+
atom([Point]),
45+
atom([Point])
4646
]
4747

4848
assert types[{:fun1, 4}] == {:infer, nil, [{args, atom([:ok])}]}
@@ -62,7 +62,7 @@ defmodule Module.Types.InferTest do
6262
number = union(integer(), float())
6363

6464
assert types[{:fun, 1}] ==
65-
{:infer, nil, [{[dynamic(open_map(foo: number, bar: number))], dynamic(number)}]}
65+
{:infer, nil, [{[open_map(foo: number, bar: number)], dynamic(number)}]}
6666
end
6767

6868
test "infer with Elixir built-in", config do
@@ -73,7 +73,7 @@ defmodule Module.Types.InferTest do
7373

7474
assert types[{:parse, 1}] ==
7575
{:infer, nil,
76-
[{[dynamic()], dynamic(union(atom([:error]), tuple([integer(), term()])))}]}
76+
[{[term()], dynamic(union(atom([:error]), tuple([integer(), term()])))}]}
7777
end
7878

7979
test "merges patterns", config do
@@ -87,11 +87,11 @@ defmodule Module.Types.InferTest do
8787
end
8888

8989
assert types[{:fun, 1}] ==
90-
{:infer, [dynamic(union(atom([:ok, :error]), binary()))],
90+
{:infer, [union(atom([:ok, :error]), binary())],
9191
[
92-
{[dynamic(atom([:ok]))], atom([:one])},
93-
{[dynamic(binary())], atom([:two, :three, :four])},
94-
{[dynamic(atom([:error]))], atom([:five])}
92+
{[atom([:ok])], atom([:one])},
93+
{[binary()], atom([:two, :three, :four])},
94+
{[atom([:error])], atom([:five])}
9595
]}
9696
end
9797

@@ -104,7 +104,7 @@ defmodule Module.Types.InferTest do
104104
end
105105

106106
assert types[{:pub, 1}] ==
107-
{:infer, nil, [{[dynamic(atom([:ok, :error]))], dynamic(atom([:ok, :error]))}]}
107+
{:infer, nil, [{[atom([:ok, :error])], dynamic(atom([:ok, :error]))}]}
108108

109109
assert types[{:priv, 1}] == nil
110110
end
@@ -119,7 +119,7 @@ defmodule Module.Types.InferTest do
119119
end
120120

121121
assert types[{:pub, 1}] ==
122-
{:infer, nil, [{[dynamic(atom([:ok, :error]))], dynamic(atom([:ok, :error]))}]}
122+
{:infer, nil, [{[atom([:ok, :error])], dynamic(atom([:ok, :error]))}]}
123123
end
124124

125125
test "infers return types even with loops", config do
@@ -128,6 +128,6 @@ defmodule Module.Types.InferTest do
128128
def pub(x), do: pub(x)
129129
end
130130

131-
assert types[{:pub, 1}] == {:infer, nil, [{[dynamic()], dynamic()}]}
131+
assert types[{:pub, 1}] == {:infer, nil, [{[term()], dynamic()}]}
132132
end
133133
end

lib/elixir/test/elixir/module/types/integration_test.exs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,11 @@ defmodule Module.Types.IntegrationTest do
232232
refute stderr =~ "this_wont_warn"
233233

234234
itself_arg = fn mod ->
235-
{_, %{sig: {:infer, nil, [{[value], value}]}}} =
235+
{_, %{sig: {:infer, nil, [{[domain], return}]}}} =
236236
List.keyfind(read_chunk(modules[mod]).exports, {:itself, 1}, 0)
237237

238-
value
238+
assert equal?(dynamic(domain), return)
239+
return
239240
end
240241

241242
assert itself_arg.(Itself.Atom) == dynamic(atom())
@@ -295,10 +296,10 @@ defmodule Module.Types.IntegrationTest do
295296
but expected one of:
296297
297298
#1
298-
dynamic(:ok)
299+
:ok
299300
300301
#2
301-
dynamic(:error)
302+
:error
302303
""",
303304
"""
304305
warning: the following pattern will never match:
@@ -710,7 +711,7 @@ defmodule Module.Types.IntegrationTest do
710711
711712
but expected one of:
712713
713-
dynamic(:ok)
714+
:ok
714715
715716
typing violation found at:
716717

0 commit comments

Comments
 (0)