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

error for 1/1.WHAT #4949

Closed
p6rt opened this issue Dec 28, 2015 · 7 comments
Closed

error for 1/1.WHAT #4949

p6rt opened this issue Dec 28, 2015 · 7 comments
Labels
LHF Low-hanging fruit, easy to resolve

Comments

@p6rt
Copy link

p6rt commented Dec 28, 2015

Migrated from rt.perl.org#127051 (status was 'resolved')

Searchable as RT127051$

@p6rt
Copy link
Author

p6rt commented Dec 28, 2015

From @zoffixznet

The error message can probably be improved, as from user's perspective, there's no "de" parameter at hand​:

<Zoffix> m​: say 1/1.WHAT
<camelia> rakudo-moar a7ea8e​: OUTPUT«Parameter 'de' requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in block <unit> at /tmp/ht6mu8fx2K line 1␤␤»

Relevant IRC conversation​: http://irclog.perlgeek.de/perl6/2015-12-28#i_11788457

@p6rt
Copy link
Author

p6rt commented Dec 28, 2015

From @zoffixznet

here's related one for the numerator​:

<Zoffix> m​: say Int/Int.WHAT
<camelia> rakudo-moar a7ea8e​: OUTPUT«Parameter 'nu' requires an instance of type Int, but a type object was passed. Did you forget a .new?␤ in block <unit> at /tmp/LnnSdb0IY8 line 1␤␤»

@p6rt
Copy link
Author

p6rt commented Apr 26, 2016

From @coke

On Sun Dec 27 18​:27​:03 2015, cpan@​zoffix.com wrote​:

here's related one for the numerator​:

<Zoffix> m​: say Int/Int.WHAT
<camelia> rakudo-moar a7ea8e​: OUTPUT«Parameter 'nu' requires an
instance of type Int, but a type object was passed. Did you forget a
.new?␤ in block <unit> at /tmp/LnnSdb0IY8 line 1␤␤»

So, the issue here is that because of the precedence, we're trying to divide by a type object (1/1.WHAT) === 1/(1.WHAT).

But, nu/de are not the names of the Rat attributes. I suspect the issue might be with src/core/Rat.pm's

  sub DIVIDE_NUMBERS(Int​:D \nu, Int​:D \de, $t1, $t2) {

perhaps renaming those args is the simplest fix here.

--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Apr 26, 2016

From @coke

On Sun Dec 27 18​:27​:03 2015, cpan@​zoffix.com wrote​:

here's related one for the numerator​:

<Zoffix> m​: say Int/Int.WHAT
<camelia> rakudo-moar a7ea8e​: OUTPUT«Parameter 'nu' requires an
instance of type Int, but a type object was passed. Did you forget a
.new?␤ in block <unit> at /tmp/LnnSdb0IY8 line 1␤␤»

So, the issue here is that because of the precedence, we're trying to divide by a type object (1/1.WHAT) === 1/(1.WHAT).

But, nu/de are not the names of the Rat attributes. I suspect the issue might be with src/core/Rat.pm's

  sub DIVIDE_NUMBERS(Int​:D \nu, Int​:D \de, $t1, $t2) {

perhaps renaming those args is the simplest fix here.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

From @zoffixznet

♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
For SQUASHathoners​:
♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥

The likely fix would involve add `​:D` type constraint smileys to parameters of all of these operators​: https://github.com/rakudo/rakudo/blob/98fae3d84/src/core/Rat.pm#L86-L224

We don't test textual content of error messages in roast, so the tests for this ticket will likely need to go into rakudo's test suit instead​: https://github.com/rakudo/rakudo/blob/nom/t/05-messages/01-errors.t

@p6rt
Copy link
Author

p6rt commented Jan 3, 2018

From @zoffixznet

Fixed and tested in rakudo/rakudo#1359

@p6rt p6rt closed this as completed Jan 3, 2018
@p6rt
Copy link
Author

p6rt commented Jan 3, 2018

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt added the LHF Low-hanging fruit, easy to resolve label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LHF Low-hanging fruit, easy to resolve
Projects
None yet
Development

No branches or pull requests

1 participant