Method: Puppet::Pops::Types::TypeMismatchDescriber#describe_no_block_arguments

Defined in:
lib/puppet/pops/types/type_mismatch_describer.rb

#describe_no_block_arguments(signature, atypes, path, expected_size, actual_size, arg_count) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 718

def describe_no_block_arguments(signature, atypes, path, expected_size, actual_size, arg_count)
  # not assignable if the number of types in actual is outside number of types in expected
  if expected_size.assignable?(actual_size)
    etypes = signature.type.param_types.types
    enames = signature.parameter_names
    arg_count.times do |index|
      adx = index >= etypes.size ? etypes.size - 1 : index
      etype = etypes[adx]
      unless etype.assignable?(atypes[index])
        descriptions = describe(etype, atypes[index], path + [ParameterPathElement.new(enames[adx])])
        return descriptions unless descriptions.empty?
      end
    end
    EMPTY_ARRAY
  else
    [CountMismatch.new(path, expected_size, actual_size)]
  end
end