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

Inconsistent error for chr with large codepoints #2270

Closed
zoffixznet opened this issue Sep 10, 2018 · 2 comments
Closed

Inconsistent error for chr with large codepoints #2270

zoffixznet opened this issue Sep 10, 2018 · 2 comments
Labels
consistency rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast tests needed Issue is generally resolved but tests were not written yet

Comments

@zoffixznet
Copy link
Contributor

The first error says stuff's out of bounds and states what the maximum is. The other just says the number's too large.

<Zoffix_> m: dd chr 2**30
<camelia> rakudo-moar ca5825b4f: OUTPUT: «Error encoding UTF-8 string: could not encode codepoint 1073741824 (0x40000000), codepoint out of bounds. Cannot encode higher than 1114111 (0x10FFFF)␤  in block <unit> at <tmp> line 1␤␤»

<Zoffix_> m: dd chr 2**32
<camelia> rakudo-moar ca5825b4f: OUTPUT: «chr codepoint 4294967296 (0x100000000) is too large␤  in block <unit> at <tmp> line 1␤␤»

Also, both throw X::AdHoc; if there's a way to throw something typed instead that'd be even better. (spotted during 6.d review of Raku/roast@fbdb81807 so if we get a typed exception that test can simply be modified)

@lizmat
Copy link
Contributor

lizmat commented Sep 12, 2018

Made the error (almost) the same: c8db35e32a .

This should make it easier to test for the error, but making a typed Exception for both cases appears a bit more difficult as it would involve stuff in NQP, probably MoarVM.

So afaiac, we can close this ticket now.

@zoffixznet zoffixznet added tests needed Issue is generally resolved but tests were not written yet rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast labels Sep 12, 2018
@AlexDaniel
Copy link
Contributor

So-o-o… I'm not sure if this is resolved. I think the idea for the OP was that error messages should be the same? But…

say chr 2**30
Error encoding UTF-8 string: could not encode codepoint 1073741824 (0x40000000), codepoint out of bounds. Cannot encode higher than 1114111 (0x10FFFF)
  in block <unit> at -e line 1
say chr 2**32
Error encoding UTF-8 string: could not encode codepoint 4294967296 (0x100000000), codepoint out of bounds.
  in block <unit> at -e line 1

I mean, if they're different anyway but we say that it's OK, then what was the issue with the original message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consistency rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast tests needed Issue is generally resolved but tests were not written yet
Projects
None yet
Development

No branches or pull requests

4 participants