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

Cannot assign a Rat to a Complex #3455

Closed
p6rt opened this issue Jul 20, 2014 · 5 comments
Closed

Cannot assign a Rat to a Complex #3455

p6rt opened this issue Jul 20, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jul 20, 2014

Migrated from rt.perl.org#122347 (status was 'rejected')

Searchable as RT122347$

@p6rt
Copy link
Author

p6rt commented Jul 20, 2014

From @coke

S02-types/declare.t contains a test which relies on this working​:

13​:51 < [Coke]> m​: my Complex $namcu =1.3; say $namcu.WHAT;
13​:51 <+camelia> rakudo-moar bbdcfd​: OUTPUT«Type check failed in assignment to
  '$namcu'; expected 'Complex' but got 'Rat'␤ in block at
  /tmp/RwaUOyDQ9D​:1␤␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Aug 21, 2014

From @coke

On Sun Jul 20 10​:54​:43 2014, coke wrote​:

S02-types/declare.t contains a test which relies on this working​:

13​:51 < [Coke]> m​: my Complex $namcu =1.3; say $namcu.WHAT;
13​:51 <+camelia> rakudo-moar bbdcfd​: OUTPUT«Type check failed in
assignment to
'$namcu'; expected 'Complex' but got 'Rat'␤ in block
at
/tmp/RwaUOyDQ9D​:1␤␤»

15​:28 < TimToady> [Coke]​: I think it's fair for that to fail, and require the
  (NYI) Complex(Cool) type for that to work
15​:29 < TimToady> but I could perhaps be argued into special casing that to work

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 2, 2014

From @jnthn

On Thu Aug 21 12​:33​:48 2014, coke wrote​:

On Sun Jul 20 10​:54​:43 2014, coke wrote​:

S02-types/declare.t contains a test which relies on this working​:

13​:51 < [Coke]> m​: my Complex $namcu =1.3; say $namcu.WHAT;
13​:51 <+camelia> rakudo-moar bbdcfd​: OUTPUT«Type check failed in
assignment to
'$namcu'; expected 'Complex' but got 'Rat'␤ in
block
at
/tmp/RwaUOyDQ9D​:1␤␤»

15​:28 < TimToady> [Coke]​: I think it's fair for that to fail, and
require the
(NYI) Complex(Cool) type for that to work
15​:29 < TimToady> but I could perhaps be argued into special casing
that to work

By contrast, I can't be argued into making that work. :-) Type constraints should be constraints, or we can't trust them. Coercion types are spec'd for coercing, and in this case a complex literal is just​:

my Complex $namcu = 1.3 + 0i; say $namcu.WHAT
(Complex)

Turns out the test isn't actually interested in coercion at all, though. It just wants to check you can assign a complex number to a variable with the Complex type - or at least, all the tests around it are doing that kind of thing. So, I got the test in line with those around it, and am rejecting the ticket.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Oct 2, 2014

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 2, 2014

@jnthn - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant