<commit_before>module Synthesis
  module Expectation
    def self.new(receiver, method, track, args = [], return_value = nil)
      receiver.expectation(method, track, args, return_value)
    end
  
    class Expectation
      include Logging
      attr_reader :receiver, :method
      attr_accessor :args, :return_value
      
      def initialize(receiver, method, track, args, return_value)
        @receiver, @method, @track, @args = receiver, method, track, args
        @return_value = return_value
      end
      
      def record_invocations
        meta_receiver.extend Recordable
        meta_receiver.recordable_method @method
      end
      
      def ==(other)
        eql?(other)
      end
      
      def invoked?
        @invoked
      end
      
      def invoked!
        @invoked = true
      end
      
      protected
      
      def args_match?(other)
        self.args.map { |arg| arg.class } == other.args.map { |arg| arg.class }
      end
    end
  
    class Singleton < Expectation
      def meta_receiver
        @receiver.__metaclass__
      end
      
      def eql?(other)
        return false unless other.is_a?(Synthesis::Expectation::Singleton)
        @receiver.name == other.receiver.name && 
        @method == other.method &&
        return_value.class == other.return_value.class &&
        args_match?(other)
      end
      
      def hash
        (@receiver.name.hash * 23) + @method.hash
      end
      
      def to_s
        "#{@receiver.name}.#{@method}(#{@args.map { |arg| arg.class } * ', '}) in #{@track}"
      end
    end
    
    class Instance < Expectation
      def meta_receiver
        @receiver.class
      end
      
      def eql?(other)
        return false unless other.is_a?(Synthesis::Expectation::Instance)
        meta_receiver.name == other.meta_receiver.name && 
        @method == other.method &&
        return_value.class == other.return_value.class &&
        args_match?(other)
      end
      
      def hash
        (meta_receiver.name.hash * 23) + @method.hash
      end
      
      def to_s
        "#{meta_receiver.name}.new.#{@method}(#{@args.map { |arg| arg.class } * ', '}) in #{@track}"
      end
    end
    
    class NilExpectation < Expectation
      def initialize;end
      def invoked!;end
      def record_invocations;end
    end<commit_msg>Include return type in expectation to_s<commit_after>module Synthesis
  module Expectation
    def self.new(receiver, method, track, args = [], return_value = nil)
      receiver.expectation(method, track, args, return_value)
    end
  
    class Expectation
      include Logging
      attr_reader :receiver, :method
      attr_accessor :args, :return_value
      
      def initialize(receiver, method, track, args, return_value)
        @receiver, @method, @track, @args = receiver, method, track, args
        @return_value = return_value
      end
      
      def record_invocations
        meta_receiver.extend Recordable
        meta_receiver.recordable_method @method
      end
      
      def ==(other)
        eql?(other)
      end
      
      def invoked?
        @invoked
      end
      
      def invoked!
        @invoked = true
      end
      
      protected
      
      def args_match?(other)
        self.args.map { |arg| arg.class } == other.args.map { |arg| arg.class }
      end
    end
  
    class Singleton < Expectation
      def meta_receiver
        @receiver.__metaclass__
      end
      
      def eql?(other)
        return false unless other.is_a?(Synthesis::Expectation::Singleton)
        @receiver.name == other.receiver.name && 
        @method == other.method &&
        return_value.class == other.return_value.class &&
        args_match?(other)
      end
      
      def hash
        (@receiver.name.hash * 23) + @method.hash
      end
      
      def to_s
        "(#{return_value.class})#{@receiver.name}.#{@method}(#{@args.map { |arg| arg.class } * ', '}) in #{@track}"
      end
    end
    
    class Instance < Expectation
      def meta_receiver
        @receiver.class
      end
      
      def eql?(other)
        return false unless other.is_a?(Synthesis::Expectation::Instance)
        meta_receiver.name == other.meta_receiver.name && 
        @method == other.method &&
        return_value.class == other.return_value.class &&
        args_match?(other)
      end
      
      def hash
        (meta_receiver.name.hash * 23) + @method.hash
      end
      
      def to_s
        "(#{return_value.class})#{meta_receiver.name}.new.#{@method}(#{@args.map { |arg| arg.class } * ', '}) in #{@track}"
      end
    end
    
    class NilExpectation < Expectation
      def initialize;end
      def invoked!;end
      def record_invocations;end
    end
{'fraction_non_alphanumeric': 0.10366624525916561, 'fraction_numerical': 0.001685630004214075, 'mean_word_length': 1.963171036204744, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6410581', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1453, 'n_words': 316}