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

Nil default value gets faulty error message #4554

Closed
p6rt opened this issue Sep 18, 2015 · 3 comments
Closed

Nil default value gets faulty error message #4554

p6rt opened this issue Sep 18, 2015 · 3 comments

Comments

@p6rt
Copy link

p6rt commented Sep 18, 2015

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

Searchable as RT126105$

@p6rt
Copy link
Author

p6rt commented Sep 18, 2015

From zefram@fysh.org

$ ./perl6 -e 'my Int $a is default(Nil); say $a'
===SORRY!=== Error while compiling -e
Default value '(Any)' will never bind to a parameter of type Int
at -e​:1
------> my Int $a is default(Nil)^; say $a
  expecting any of​:
  constraint

The error message is correct that this is a bad default value for
the variable's type, but it is incorrect in identifying the value.
The failure mode looks very much like [perl #​126091], which occurred in
a situation where Nil was a type constraint.

-zefram

@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

From @usev6

The correct default value Nil is now mentioned in the error message​:

$ perl6-m -e 'my Int $a is default(Nil)'
===SORRY!=== Error while compiling -e
Default value 'Nil' will never bind to a parameter of type Int
at -e​:1
------> my Int $a is default(Nil)⏏<EOL>
  expecting any of​:
  constraint

I added a test to S32-exceptions/misc.t with commit Raku/roast@01a65f421d

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

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

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

1 participant