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

clashing Nil type constraints incorrectly described #6105

Open
p6rt opened this issue Feb 27, 2017 · 4 comments
Open

clashing Nil type constraints incorrectly described #6105

p6rt opened this issue Feb 27, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 27, 2017

Migrated from rt.perl.org#130875 (status was 'open')

Searchable as RT130875$

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

From zefram@fysh.org

my Int $a of Nil
===SORRY!=== Error while compiling​:
Mu not allowed here; variable list already declared with type Int
at line 2
------> <BOL>^<EOL>
  expecting any of​:
  constraint
my Nil $a of Int
===SORRY!=== Error while compiling​:
Int not allowed here; variable list already declared with type Mu
at line 2
------> <BOL>^<EOL>
  expecting any of​:
  constraint

In both of these cases of multiple type constraints, the Nil type
constraint is incorrectly described as "Mu". The same problem
also occurs if both type constraints are specified in the "of" form.
The error messages are otherwise correct, and the corresponding messages
for other types are correct. A Nil type constraint specified without
a clash actually behaves (mostly correctly) as a Nil type constraint,
not as a Mu type constraint.

-zefram

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

From @lizmat

Feels to me that Nil should not be allowed as a type constraint at all.

On 27 Feb 2017, at 09​:11, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​130875]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130875 >

my Int $a of Nil
===SORRY!=== Error while compiling​:
Mu not allowed here; variable list already declared with type Int
at line 2
------> <BOL>^<EOL>
expecting any of​:
constraint
my Nil $a of Int
===SORRY!=== Error while compiling​:
Int not allowed here; variable list already declared with type Mu
at line 2
------> <BOL>^<EOL>
expecting any of​:
constraint

In both of these cases of multiple type constraints, the Nil type
constraint is incorrectly described as "Mu". The same problem
also occurs if both type constraints are specified in the "of" form.
The error messages are otherwise correct, and the corresponding messages
for other types are correct. A Nil type constraint specified without
a clash actually behaves (mostly correctly) as a Nil type constraint,
not as a Mu type constraint.

-zefram

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

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

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

From zefram@fysh.org

Elizabeth Mattijsen via RT wrote​:

Feels to me that Nil should not be allowed as a type constraint at all.

It's a type. The correct behaviour of it as a type constraint is obvious
from that observation, and it does in fact exhibit that correct behaviour.
(My "mostly" remark was referring to a problem I thought I was seeing but
turned out to be me being misled by [perl #​130874], with extra confusion
supplied by [perl #​130876].) I don't see good grounds to forbid it.
Indeed, if it were forbidden then that would be surprising, and you'd
have to document how it can't be used in the way that all other types can.

-zefram

@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