lib/raap/method_property.rb in raap-0.1.0 vs lib/raap/method_property.rb in raap-0.2.0

- old
+ new

@@ -22,13 +22,10 @@ @timeout = timeout end def run stats = Stats.new - if receiver_type.type.to_s == 'String' && method_name == :initialize - return stats - end begin Timeout.timeout(@timeout) do catch(:break) do @size_step.each do |size| yield call(size: size, stats: stats) @@ -46,28 +43,35 @@ def call(size:, stats:) receiver_value = receiver_type.pick(size: size, eval: false) arguments = method_type.pick_arguments(size: size, eval: false) method_value = MethodValue.new(receiver_value:, arguments:, method_name:, size:) symbolic_call = method_value.to_symbolic_call - check = false - if return_type.instance_of?(::RBS::Types::Bases::Bottom) - begin + begin + # ensure method_value + check = false + if return_type.instance_of?(::RBS::Types::Bases::Bottom) + begin + return_value = SymbolicCaller.new(symbolic_call).eval + rescue => e + check = true + return_value = Value::Bottom.new + end + else return_value = SymbolicCaller.new(symbolic_call).eval - rescue => e - check = true - return_value = Value::Bottom.new + check = check_return(receiver_value:, return_value:, method_type:) end - else - return_value = SymbolicCaller.new(symbolic_call).eval - check = check_return(receiver_value:, return_value:, method_type:) - end - if check - stats.success += 1 - Result::Success.new(method_value:, return_value:) - else + if check + stats.success += 1 + Result::Success.new(method_value:, return_value:) + else + Result::Failure.new(method_value:, return_value:, symbolic_call:) + end + rescue TypeError => exception Result::Failure.new(method_value:, return_value:, symbolic_call:) end + + # not ensure method_value rescue NoMethodError => exception stats.skip += 1 Result::Skip.new(method_value:, exception:) rescue NameError => e msg = e.name.nil? ? '' : "for `#{BindCall.to_s(e.receiver)}::#{e.name}`" @@ -78,12 +82,10 @@ Result::Skip.new(method_value:, exception:) rescue SystemStackError => exception stats.skip += 1 RaaP.logger.warn "Found recursive type definition." Result::Skip.new(method_value: nil, exception:) - rescue TypeError => exception - Result::Failure.new(method_value:, return_value:, symbolic_call:) rescue => exception stats.exception += 1 Result::Exception.new(method_value:, exception:) end @@ -102,10 +104,10 @@ type_check = ::RBS::Test::TypeCheck.new( self_class: self_class, instance_class: instance_class, class_class: Module, builder: RBS.builder, - sample_size: 1, + sample_size: 100, unchecked_classes: [] ) begin type_check.value(return_value, return_type) rescue => e