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

Assuming unknown named parameters gives an empty error message #3624

Closed
p6rt opened this issue Dec 25, 2014 · 5 comments
Closed

Assuming unknown named parameters gives an empty error message #3624

p6rt opened this issue Dec 25, 2014 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 25, 2014

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

Searchable as RT123498$

@p6rt
Copy link
Author

p6rt commented Dec 25, 2014

From naddiseo@gmail.com

If an unknown parameter is passed to assuming, the resulting error message
is uninformative.

Minimal testcase​:
sub (​:@​a) {}.assuming(named => (True))()

Resulting output​: (there is no error message, just a traceback)

  in sub at foo.pl​:1
  in sub CURRIED at src/gen/m-CORE.setting​:3478
  in block <unit> at foo.pl​:1

Interestingly, if the signature is removed, or is changed to a scalar, then
there isn't even a traceback.
The following produce no traceback or error message

sub {}.assuming(named => (True))()
sub (​:$a) {}.assuming(named => True)()

This is perl6 version 2014.09 built on MoarVM version 2014.09

@p6rt
Copy link
Author

p6rt commented Dec 25, 2014

From @moritz

On Thu Dec 25 13​:03​:47 2014, naddiseo@​gmail.com wrote​:

If an unknown parameter is passed to assuming, the resulting error message
is uninformative.

Minimal testcase​:
sub (​:@​a) {}.assuming(named => (True))()

Resulting output​: (there is no error message, just a traceback)

in sub at foo.pl​:1
in sub CURRIED at src/gen/m-CORE.setting​:3478
in block <unit> at foo.pl​:1

Fixed in this commit​:

commit 964e0ddc6dde60bc7b2d0586c813459bd7981cb1
Author​: Moritz Lenz <moritz@​faui2k3.org>
Date​: 2014-12-25 22​:24​:08 +0100

  RT #​123498​: Empty binding error in some cases (partial fix)
 
  On MoarVM, if unexpected named parameters came in through capture or hash
  interpolation, the error message would be empty.
 
  An "if $error" would be false in the case, because $error is usually an empt
  array. Changing it to an "if nqp​::defined($error)" as the rest of the code
  uses should prevent error messages from going missing.

Interestingly, if the signature is removed, or is changed to a scalar, then
there isn't even a traceback.
The following produce no traceback or error message

sub {}.assuming(named => (True))()
sub (​:$a) {}.assuming(named => True)()

This seems to be a separate error, and can be boiled down to​:

sub () {}.(|{​:a})

xfix++ for golfing it down.

@p6rt
Copy link
Author

p6rt commented Dec 25, 2014

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

@p6rt
Copy link
Author

p6rt commented Nov 16, 2015

From @jnthn

On Thu Dec 25 14​:08​:04 2014, moritz wrote​:

On Thu Dec 25 13​:03​:47 2014, naddiseo@​gmail.com wrote​:

If an unknown parameter is passed to assuming, the resulting error
message
is uninformative.

Minimal testcase​:
sub (​:@​a) {}.assuming(named => (True))()

Resulting output​: (there is no error message, just a traceback)

in sub at foo.pl​:1
in sub CURRIED at src/gen/m-CORE.setting​:3478
in block <unit> at foo.pl​:1

Fixed in this commit​:

commit 964e0ddc6dde60bc7b2d0586c813459bd7981cb1
Author​: Moritz Lenz <moritz@​faui2k3.org>
Date​: 2014-12-25 22​:24​:08 +0100

RT #​123498​: Empty binding error in some cases (partial fix)

On MoarVM, if unexpected named parameters came in through capture or
hash
interpolation, the error message would be empty.

An "if $error" would be false in the case, because $error is usually
an empt
array. Changing it to an "if nqp​::defined($error)" as the rest of the
code
uses should prevent error messages from going missing.

Interestingly, if the signature is removed, or is changed to a
scalar, then
there isn't even a traceback.
The following produce no traceback or error message

sub {}.assuming(named => (True))()
sub (​:$a) {}.assuming(named => True)()

This seems to be a separate error, and can be boiled down to​:

sub () {}.(|{​:a})

xfix++ for golfing it down.

I ended up rediscovering and fixing this today while working on other issues with flattening named args. Tests passing and unfudged.

/jnthn

@p6rt p6rt closed this as completed Nov 16, 2015
@p6rt
Copy link
Author

p6rt commented Nov 16, 2015

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

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

No branches or pull requests

1 participant