@@ -22,8 +22,8 @@ def initialize(self_class:, builder:, sample_size:, unchecked_classes:, instance
2222 end
2323
2424 def overloaded_call ( method , method_name , call , errors :)
25- es = method . method_types . map do |method_type |
26- es = method_call ( method_name , method_type , call , errors : [ ] )
25+ es = method . defs . map do |type_def |
26+ es = method_call ( method_name , type_def . type , call , errors : [ ] , annotations : type_def . annotations )
2727
2828 if es . empty?
2929 return errors
@@ -58,11 +58,11 @@ def overloaded_call(method, method_name, call, errors:)
5858 errors
5959 end
6060
61- def method_call ( method_name , method_type , call , errors :)
61+ def method_call ( method_name , method_type , call , errors :, annotations : [ ] )
6262 return errors if method_type . type . is_a? ( Types ::UntypedFunction )
6363
6464 args ( method_name , method_type , method_type . type , call . method_call , errors , type_error : Errors ::ArgumentTypeError , argument_error : Errors ::ArgumentError )
65- self . return ( method_name , method_type , method_type . type , call . method_call , errors , return_error : Errors ::ReturnTypeError )
65+ self . return ( method_name , method_type , method_type . type , call . method_call , errors , return_error : Errors ::ReturnTypeError , annotations : )
6666
6767 if method_type . block
6868 case
@@ -106,8 +106,10 @@ def args(method_name, method_type, fun, call, errors, type_error:, argument_erro
106106 end
107107 end
108108
109- def return ( method_name , method_type , fun , call , errors , return_error :)
109+ def return ( method_name , method_type , fun , call , errors , return_error :, annotations : [ ] )
110110 if call . return?
111+ return if Test . call ( call . return_value , IS_AP , NilClass ) && annotations . find { |a | a . string == "implicitly-returns-nil" }
112+
111113 unless value ( call . return_value , fun . return_type )
112114 errors << return_error . new ( klass : self_class ,
113115 method_name : method_name ,
0 commit comments