@@ -43,16 +43,6 @@ defmodule Module.Types.ExprTest do
4343 assert typecheck! ( [ x ] , [ :ok | x ] ) == dynamic ( non_empty_list ( term ( ) , term ( ) ) )
4444 end
4545
46- test "inference" do
47- assert typecheck! (
48- [ x , y , z ] ,
49- (
50- List . to_integer ( [ x , y | z ] )
51- { x , y , z }
52- )
53- ) == dynamic ( tuple ( [ integer ( ) , integer ( ) , list ( integer ( ) ) ] ) )
54- end
55-
5646 test "hd" do
5747 assert typecheck! ( [ x = [ 123 , :foo ] ] , hd ( x ) ) == dynamic ( union ( atom ( [ :foo ] ) , integer ( ) ) )
5848 assert typecheck! ( [ x = [ 123 | :foo ] ] , hd ( x ) ) == dynamic ( integer ( ) )
@@ -127,16 +117,6 @@ defmodule Module.Types.ExprTest do
127117 end
128118
129119 describe "funs" do
130- test "infers calls" do
131- assert typecheck! (
132- [ x ] ,
133- (
134- x . ( 1 , 2 )
135- x
136- )
137- ) == dynamic ( fun ( 2 ) )
138- end
139-
140120 test "infers functions" do
141121 assert typecheck! ( & & 1 ) == fun ( [ dynamic ( ) ] , dynamic ( ) )
142122 assert typecheck! ( fn -> :ok end ) == fun ( [ ] , atom ( [ :ok ] ) )
@@ -263,53 +243,6 @@ defmodule Module.Types.ExprTest do
263243 assert typecheck! ( [ % x { } ] , x . foo_bar ( ) ) == dynamic ( )
264244 end
265245
266- test "infers atoms" do
267- assert typecheck! (
268- [ x ] ,
269- (
270- x . foo_bar ( )
271- x
272- )
273- ) == dynamic ( atom ( ) )
274-
275- assert typecheck! (
276- [ x ] ,
277- (
278- x . foo_bar ( 123 )
279- x
280- )
281- ) == dynamic ( atom ( ) )
282-
283- assert typecheck! (
284- [ x ] ,
285- (
286- & x . foo_bar / 1
287- x
288- )
289- ) == dynamic ( atom ( ) )
290- end
291-
292- test "infers maps" do
293- assert typecheck! (
294- [ x ] ,
295- (
296- :foo = x . foo_bar
297- 123 = x . baz_bat
298- x
299- )
300- ) == dynamic ( open_map ( foo_bar: atom ( [ :foo ] ) , baz_bat: integer ( ) ) )
301- end
302-
303- test "infers args" do
304- assert typecheck! (
305- [ x , y ] ,
306- (
307- z = Integer . to_string ( x + y )
308- { x , y , z }
309- )
310- ) == dynamic ( tuple ( [ integer ( ) , integer ( ) , binary ( ) ] ) )
311- end
312-
313246 test "undefined function warnings" do
314247 assert typewarn! ( URI . unknown ( "foo" ) ) ==
315248 { dynamic ( ) , "URI.unknown/1 is undefined or private" }
@@ -535,16 +468,6 @@ defmodule Module.Types.ExprTest do
535468 end
536469
537470 describe "binaries" do
538- test "inference" do
539- assert typecheck! (
540- [ x , y ] ,
541- (
542- << x :: float - size ( y ) >>
543- { x , y }
544- )
545- ) == dynamic ( tuple ( [ union ( float ( ) , integer ( ) ) , integer ( ) ] ) )
546- end
547-
548471 test "warnings" do
549472 assert typeerror! ( [ << x :: binary - size ( 2 ) >> ] , << x :: float >> ) ==
550473 ~l"""
@@ -644,16 +567,6 @@ defmodule Module.Types.ExprTest do
644567 assert typecheck! ( [ x ] , { :ok , x } ) == dynamic ( tuple ( [ atom ( [ :ok ] ) , term ( ) ] ) )
645568 end
646569
647- test "inference" do
648- assert typecheck! (
649- [ x , y ] ,
650- (
651- { :ok , :error } = { x , y }
652- { x , y }
653- )
654- ) == dynamic ( tuple ( [ atom ( [ :ok ] ) , atom ( [ :error ] ) ] ) )
655- end
656-
657570 test "elem/2" do
658571 assert typecheck! ( elem ( { :ok , 123 } , 0 ) ) == atom ( [ :ok ] )
659572 assert typecheck! ( elem ( { :ok , 123 } , 1 ) ) == integer ( )
@@ -1458,16 +1371,6 @@ defmodule Module.Types.ExprTest do
14581371 ) == dynamic ( atom ( [ :ok , :error , :timeout ] ) )
14591372 end
14601373
1461- test "infers type for timeout" do
1462- assert typecheck! (
1463- [ x ] ,
1464- receive do
1465- after
1466- x -> x
1467- end
1468- ) == dynamic ( union ( integer ( ) , atom ( [ :infinity ] ) ) )
1469- end
1470-
14711374 test "resets branches" do
14721375 assert typecheck! (
14731376 [ x , timeout = :infinity ] ,
@@ -1854,16 +1757,6 @@ defmodule Module.Types.ExprTest do
18541757 """
18551758 end
18561759
1857- test "infers binary generators" do
1858- assert typecheck! (
1859- [ x ] ,
1860- (
1861- for << _ <- x >> , do: :ok
1862- x
1863- )
1864- ) == dynamic ( binary ( ) )
1865- end
1866-
18671760 test ":into" do
18681761 assert typecheck! ( [ binary ] , for ( << x <- binary >> , do: x ) ) == list ( integer ( ) )
18691762 assert typecheck! ( [ binary ] , for ( << x <- binary >> , do: x , into: [ ] ) ) == list ( integer ( ) )
@@ -1901,20 +1794,6 @@ defmodule Module.Types.ExprTest do
19011794 end
19021795 ) == union ( atom ( [ :ok ] ) , union ( integer ( ) , float ( ) ) )
19031796 end
1904-
1905- test ":reduce inference" do
1906- assert typecheck! (
1907- [ list , x ] ,
1908- (
1909- 123 =
1910- for _ <- list , reduce: x do
1911- x -> x
1912- end
1913-
1914- x
1915- )
1916- ) == dynamic ( integer ( ) )
1917- end
19181797 end
19191798
19201799 describe "info" do
0 commit comments