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

Mu not permitted as default value #4557

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

Mu not permitted as default value #4557

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

Comments

@p6rt
Copy link

p6rt commented Sep 19, 2015

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

Searchable as RT126110$

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

From zefram@fysh.org

$ ./perl6 -e 'my Mu $a is default(Mu); say $a'
===SORRY!=== Error while compiling -e
Can't use unknown trait 'is default' in a variable declaration.
at -e​:1
------> my Mu $a is default(Mu)^; say $a
  expecting any of​:
  TypeObject
  default
  dynamic

The "is default" trait *is* known, and works fine with most other values.
Furthermore, Mu is a valid value for this variable, so this declaration
should be semantically permitted.

If a different type constraint is used, that the value Mu doesn't satisfy,
then the incorrect "unknown trait" error is seen rather than a type
mismatch error. The incorrect error does not occur with a declared
default value of Any, Cool, or other such abstract type objects, nor
with Int or other concrete class objects. But it does occur with (Mu
but True), or with a user-defined class declared "is Mu".

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 20, 2015

From @jnthn

On Sat Sep 19 10​:45​:37 2015, zefram@​fysh.org wrote​:

$ ./perl6 -e 'my Mu $a is default(Mu); say $a'
===SORRY!=== Error while compiling -e
Can't use unknown trait 'is default' in a variable declaration.
at -e​:1
------> my Mu $a is default(Mu)^; say $a
expecting any of​:
TypeObject
default
dynamic

The "is default" trait *is* known, and works fine with most other values.
Furthermore, Mu is a valid value for this variable, so this declaration
should be semantically permitted.

If a different type constraint is used, that the value Mu doesn't satisfy,
then the incorrect "unknown trait" error is seen rather than a type
mismatch error. The incorrect error does not occur with a declared
default value of Any, Cool, or other such abstract type objects, nor
with Int or other concrete class objects. But it does occur with (Mu
but True), or with a user-defined class declared "is Mu".

Fixed, and test added in S02-names/is_default.t.

@p6rt
Copy link
Author

p6rt commented Sep 20, 2015

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

@p6rt
Copy link
Author

p6rt commented Sep 20, 2015

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

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