@@ -115,7 +115,6 @@ defmodule Module.Types.Expr do
115
115
end
116
116
117
117
# <<...>>>
118
- # TODO: here (including tests)
119
118
def of_expr ( { :<<>> , _meta , args } , _expected , _expr , stack , context ) do
120
119
context = Of . binary ( args , :expr , stack , context )
121
120
{ binary ( ) , context }
@@ -306,7 +305,6 @@ defmodule Module.Types.Expr do
306
305
end
307
306
308
307
# TODO: fn pat -> expr end
309
- # TODO: here
310
308
def of_expr ( { :fn , _meta , clauses } , _expected , _expr , stack , context ) do
311
309
[ { :-> , _ , [ head , _ ] } | _ ] = clauses
312
310
{ patterns , _guards } = extract_head ( head )
@@ -399,8 +397,6 @@ defmodule Module.Types.Expr do
399
397
|> dynamic_unless_static ( stack )
400
398
end
401
399
402
- # TODO: for pat <- expr do expr end
403
- # TODO: here
404
400
def of_expr ( { :for , meta , [ _ | _ ] = args } , expected , expr , stack , context ) do
405
401
{ clauses , [ [ { :do , block } | opts ] ] } = Enum . split ( args , - 1 )
406
402
context = Enum . reduce ( clauses , context , & for_clause ( & 1 , stack , & 2 ) )
@@ -414,6 +410,7 @@ defmodule Module.Types.Expr do
414
410
# because this is recursive. We need to infer the block type first.
415
411
of_clauses ( block , [ dynamic ( ) ] , expected , expr , :for_reduce , stack , { reduce_type , context } )
416
412
else
413
+ # TODO: Use the collectable protocol for the output
417
414
into = Keyword . get ( opts , :into , [ ] )
418
415
{ into_wrapper , gradual? , context } = for_into ( into , meta , stack , context )
419
416
{ block_type , context } = of_expr ( block , @ pending , block , stack , context )
@@ -469,7 +466,6 @@ defmodule Module.Types.Expr do
469
466
end
470
467
end
471
468
472
- # TODO: here
473
469
def of_expr (
474
470
{ { :. , _ , [ remote , :apply ] } , _meta , [ mod , fun , args ] } = call ,
475
471
expected ,
@@ -505,7 +501,6 @@ defmodule Module.Types.Expr do
505
501
end
506
502
end
507
503
508
- # TODO: here
509
504
def of_expr ( { { :. , _ , [ remote , name ] } , meta , args } = call , expected , _expr , stack , context ) do
510
505
{ remote_type , context } = of_expr ( remote , atom ( ) , call , stack , context )
511
506
{ mods , context } = Of . modules ( remote_type , name , length ( args ) , call , meta , stack , context )
@@ -532,21 +527,18 @@ defmodule Module.Types.Expr do
532
527
end
533
528
534
529
# Super
535
- # TODO: here
536
- def of_expr ( { :super , meta , args } = expr , _expected , _expr , stack , context ) when is_list ( args ) do
530
+ def of_expr ( { :super , meta , args } = call , expected , _expr , stack , context ) when is_list ( args ) do
537
531
{ _kind , fun } = Keyword . fetch! ( meta , :super )
538
- apply_local ( fun , args , expr , stack , context )
532
+ apply_local ( fun , args , expected , call , stack , context )
539
533
end
540
534
541
535
# Local calls
542
- # TODO: here
543
- def of_expr ( { fun , _meta , args } = expr , _expected , _expr , stack , context )
536
+ def of_expr ( { fun , _meta , args } = call , expected , _expr , stack , context )
544
537
when is_atom ( fun ) and is_list ( args ) do
545
- apply_local ( fun , args , expr , stack , context )
538
+ apply_local ( fun , args , expected , call , stack , context )
546
539
end
547
540
548
541
# var
549
- # TODO: here
550
542
def of_expr ( var , expected , expr , stack , context ) when is_var ( var ) do
551
543
if stack . mode == :traversal do
552
544
{ dynamic ( ) , context }
@@ -631,7 +623,6 @@ defmodule Module.Types.Expr do
631
623
defp for_into ( binary , _meta , _stack , context ) when is_binary ( binary ) ,
632
624
do: { [ :binary ] , false , context }
633
625
634
- # TODO: Use the collectable protocol for the output
635
626
defp for_into ( into , meta , stack , context ) do
636
627
meta =
637
628
case into do
@@ -689,7 +680,7 @@ defmodule Module.Types.Expr do
689
680
690
681
## General helpers
691
682
692
- defp apply_local ( fun , args , { _ , meta , _ } = expr , stack , context ) do
683
+ defp apply_local ( fun , args , _expected , { _ , meta , _ } = expr , stack , context ) do
693
684
{ local_info , domain , context } = Apply . local_domain ( fun , args , meta , stack , context )
694
685
695
686
{ args_types , context } =
0 commit comments