Skip to content

Idempotency Failure: Method Chain Ignored When Receiver Is Expanded Across Lines #933

@nicholasdower

Description

@nicholasdower

Originally reported in #915

Commit: 95210d7

Input

→ View on rubyfmt.run

(class << object; self; end).foo

Module.new { def foo; end }.foo

Output

→ View on rubyfmt.run

(class << object
  self
end).foo

Module.new {
  def foo
  end
}.foo

Second Output

(class << object
  self
end)
  .foo

Module
  .new {
    def foo
    end
  }
  .foo

Expected behavior

The output should be stable.

Found in: rspec-support 3.13.2 (lib/rspec/support/ruby_features.rb)
Found in: rspec-mocks 3.13.8 (lib/rspec/mocks/method_reference.rb)
Found in: rspec-core 3.13.6 (lib/rspec/core/dsl.rb, lib/rspec/core/configuration.rb, lib/rspec/core/example_group.rb)
Found in: irb 1.18.0 (lib/irb/ext/use-loader.rb)
Found in: dry-core 1.2.0 (lib/dry/core/basic_object.rb)
Found in: tilt 2.7.0 (lib/tilt/markaby.rb)
Found in: httpclient 2.9.0 (lib/httpclient/include_client.rb)
Found in: pry 0.16.0 (lib/pry/core_extensions.rb)
Found in: coderay 1.1.3 (lib/coderay/scanners/delphi.rb)
Found in: hashie 5.1.0 (lib/hashie/extensions/indifferent_access.rb)
Found in: rspec-rails 8.0.4 (lib/rspec/rails/example/controller_example_group.rb)
Found in: typhoeus 1.6.0 (lib/typhoeus/adapters/faraday.rb)
Found in: eventmachine 1.2.7 (lib/em/spawnable.rb)
Found in: eventmachine 1.2.7 (tests/test_basic.rb)
Found in: formatador 1.2.3 (tests/table_tests.rb)
Found in: hashery 2.1.2 (lib/hashery/open_hash.rb)
Found in: fluent-plugin-record-modifier 2.2.1 (lib/fluent/plugin/filter_record_modifier.rb, lib/fluent/plugin/out_record_modifier.rb)
Found in: cucumber 11.1.0 (lib/cucumber/glue/proto_world.rb)
Found in: elasticsearch-transport 7.17.11 (spec/elasticsearch/transport/client_spec.rb)
Found in: celluloid 0.18.0 (lib/celluloid/proxy/abstract.rb)
Found in: backports 3.25.3 (lib/backports/1.9.1/stdlib/prime.rb)
Found in: coercible 1.0.0 (spec/unit/coercible/coercer/numeric/to_decimal_spec.rb)
Found in: virtus 2.0.0 (spec/unit/virtus/attribute/hash/coerce_spec.rb)
Found in: logging 2.4.0 (lib/logging/layouts/parseable.rb)
Found in: ruby-ole 1.2.13.1 (test/test_storage.rb)
Found in: paperclip 6.1.0 (lib/paperclip/matchers/validate_attachment_size_matcher.rb)
Found in: spreadsheet 1.3.5 (test/excel/writer/workbook.rb)
Found in: elasticsearch-model 8.0.1 (spec/elasticsearch/model/adapters/mongoid_spec.rb)
Found in: trollop 2.9.10 (lib/trollop.rb)
Found in: fog 2.3.0 (lib/fog/vcloud/models/compute/networks.rb, tests/ibm/requests/compute/instance_tests.rb)
Found in: view_component 4.12.0 (lib/view_component/template.rb)
Found in: mock_redis 0.55.0 (lib/mock_redis.rb)
Found in: rails-rails main (actionpack/test/controller/runner_test.rb)
Found in: rails-rails main (actionview/test/template/lookup_context_test.rb)
Found in: rails-rails main (activerecord/test/cases/adapters/mysql2/mysql2_rake_test.rb)
Found in: rails-rails main (activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb)
Found in: rails-rails main (activerecord/test/cases/adapters/sqlite3/sqlite_rake_test.rb)
Found in: rails-rails main (activerecord/test/cases/adapters/trilogy/trilogy_rake_test.rb)
Found in: rails-rails main (activerecord/test/cases/connection_management_test.rb)
Found in: rspec-rspec main (rspec-expectations/spec/rspec/matchers/built_in/exist_spec.rb, rspec-mocks/spec/rspec/mocks/diffing_spec.rb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions