Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparation of String and Integer throws an exception with slightly different error message but in MRI #1941

Closed
deepj opened this issue Feb 28, 2020 · 2 comments
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Feb 28, 2020

There is a slight difference in exception message while comparating String and Integer between TruffleRuby and MRI.

TruffleRuby: #<ArgumentError: comparison of String with Integer>
MRI: #<ArgumentError: comparison of String with 23 failed>

This difference in TruffleRuby causes 20 failing specs in dry-schema specs where there is the following expectation

expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')

Then error is:

expected ArgumentError with "comparison of String with 23 failed", got #<ArgumentError: comparison of String with Integer> with backtrace:
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/predicates.rb:104:in `>'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/predicates.rb:104:in `gt?'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/predicates.rb:108:in `lteq?'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/rule/interface.rb:123:in `[]'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/rule/interface.rb:123:in `call'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/operations/key.rb:41:in `call'
  # ~/.gem/truffleruby/2.6.5/gems/dry-logic-1.0.6/lib/dry/logic/operations/implication.rb:22:in `call'
  # ./lib/dry/schema/rule_applier.rb:36:in `block in call'
  # ./lib/dry/schema/rule_applier.rb:33:in `each'
  # ./lib/dry/schema/rule_applier.rb:33:in `call'
  # ./lib/dry/schema/processor_steps.rb:96:in `process_step'
  # ./lib/dry/schema/processor_steps.rb:39:in `block in call'
  # ./lib/dry/schema/processor_steps.rb:37:in `each'
  # ./lib/dry/schema/processor_steps.rb:37:in `call'
  # ./lib/dry/schema/processor.rb:88:in `block in call'
  # ./lib/dry/schema/result.rb:37:in `new'
  # ./lib/dry/schema/processor.rb:87:in `call'
  # ./spec/support/predicates_integration.rb:7:in `result'
  # ./spec/integration/schema/predicates/lteq_spec.rb:103:in `block (5 levels) in <top (required)>'
  # ./spec/integration/schema/predicates/lteq_spec.rb:103:in `block (4 levels) in <top (required)>'
# ./spec/integration/schema/predicates/lteq_spec.rb:103:in `block (4 levels) in <top (required)>'
@deepj deepj changed the title Comparation of String and Integer throws an exception with slightly different error message but MRI Comparation of String and Integer throws an exception with slightly different error message but in MRI Feb 28, 2020
@eregon
Copy link
Member

eregon commented Feb 29, 2020

Thanks for the report, we should try to match MRI here, even more so since the message seems clearer.

@bjfish bjfish self-assigned this Mar 2, 2020
@bjfish
Copy link
Contributor

bjfish commented Mar 4, 2020

This is now fixed at 1afbac7.

@bjfish bjfish closed this as completed Mar 4, 2020
@bjfish bjfish added this to the 20.1.0 milestone Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants