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

"is default" spuriously rejects default values #4553

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

"is default" spuriously rejects default values #4553

p6rt opened this issue Sep 18, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 18, 2015

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

Searchable as RT126104$

@p6rt
Copy link
Author

p6rt commented Sep 18, 2015

From zefram@fysh.org

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

This error is obviously bogus​: 3 certainly is an Any. If an Any-typed
variable is declared without a default value, then 3 can be assigned to
it without trouble.

For a default value of 3, the error occurs if the variable's declared type
is Numeric, Cool, or Any, but does not occur if the type is Int or Mu.

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

From @jnthn

On Fri Sep 18 14​:19​:21 2015, zefram@​fysh.org wrote​:

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

This error is obviously bogus​: 3 certainly is an Any. If an Any-typed
variable is declared without a default value, then 3 can be assigned to
it without trouble.

For a default value of 3, the error occurs if the variable's declared type
is Numeric, Cool, or Any, but does not occur if the type is Int or Mu.

The type test was inverted. Fixed, and test added in S02-names/is_default.t.

Thanks!

/jnthn

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

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

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

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

@p6rt p6rt closed this as completed Sep 19, 2015
@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