<commit_before>module Bpl
  module AST
    
    class Program
      def type_check
        each do |elem|
          elem.type_check if elem.respond_to? :type_check unless elem == self

          # case elem
          # when FunctionApplication
          #   if d = elem.function.declaration then
          #     unless d.arguments.count == elem.arguments.count && 
          #       d.arguments.zip(elem.arguments).all?{|p,a| p.type == a.type}
          #       warn "incompatible arguments #{elem} to function " +
          #         "#{d.name}(#{d.arguments.map(&:type) * ","})" \
          #     end
          #   end
          # end
        end
      end
    end
    
    class FunctionApplication
      def type_check
        return unless d = @function.declaration
        
        flat_args = d.arguments.map(&:flatten).flatten
        warn "incompatible arguments #{self} to function #{d.signature.split[0]}" \
          unless flat_args.count == @arguments.count &&
            flat_args.zip(@arguments).all?{|p,a| p.type.eql?(a.type)}
<commit_msg>Quick fix to type warning message.<commit_after>module Bpl
  module AST
    
    class Program
      def type_check
        each do |elem|
          elem.type_check if elem.respond_to? :type_check unless elem == self

          # case elem
          # when FunctionApplication
          #   if d = elem.function.declaration then
          #     unless d.arguments.count == elem.arguments.count && 
          #       d.arguments.zip(elem.arguments).all?{|p,a| p.type == a.type}
          #       warn "incompatible arguments #{elem} to function " +
          #         "#{d.name}(#{d.arguments.map(&:type) * ","})" \
          #     end
          #   end
          # end
        end
      end
    end
    
    class FunctionApplication
      def type_check
        return unless d = @function.declaration
        
        flat_args = d.arguments.map(&:flatten).flatten
        warn "incompatible arguments #{self} to function #{d.signature.split(' returns').first}" \
          unless flat_args.count == @arguments.count &&
            flat_args.zip(@arguments).all?{|p,a| p.type.eql?(a.type)}

{'fraction_non_alphanumeric': 0.1172093023255814, 'fraction_numerical': 0.00046511627906976747, 'mean_word_length': 1.7898832684824904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5755055', 'n_tokens_mistral': 619, 'n_tokens_neox': 614, 'n_words': 140}