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

parameters with "where { } = default" sometimes require newline #3648

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

parameters with "where { } = default" sometimes require newline #3648

p6rt opened this issue Jan 19, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jan 19, 2015

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

Searchable as RT123623$

@p6rt
Copy link
Author

p6rt commented Jan 19, 2015

From @skids

Trying to compose a role that has a named parameter, when that
parameter has both a where clause and a default value, will
fail multi selection unless there is a newline before the
"=" introducing the default value. This is replicatable
a lot of the time but I could swear I saw some heisenbuggy
behavior relating to whether it was tried on -e, and whether
it was precomp.

In addition, 'where { } = default' causes a different error
when used on subroutine signatures.

This on Star 2014-12, but ugexe++ also verified on newer​:

# cat /tmp/A.pm6

role A [ :$bs where { True } = 512] { }
# PERL6LIB=/tmp/ perl6-m -e 'use A; class B does A[ ] { }; B.new;'
===SORRY!===
None of the parametric role variants for 'A' matched the arguments supplied.
Cannot modify an immutable Block
# emacs /tmp/A.pm6
# cat /tmp/A.pm6
role A [ :$bs where { True }
= 512] { }
# PERL6LIB=/tmp/ perl6-m -e 'use A; class B does A[ ] { }; B.new;'
#

For the subroutine signature problem, see​:

http://irclog.perlgeek.de/perl6/2015-01-19#i_9964933

@p6rt
Copy link
Author

p6rt commented Jun 20, 2015

From @jnthn

On Sun Jan 18 20​:48​:16 2015, bri@​abrij.org wrote​:

Trying to compose a role that has a named parameter, when that
parameter has both a where clause and a default value, will
fail multi selection unless there is a newline before the
"=" introducing the default value. This is replicatable
a lot of the time but I could swear I saw some heisenbuggy
behavior relating to whether it was tried on -e, and whether
it was precomp.

In addition, 'where { } = default' causes a different error
when used on subroutine signatures.

This on Star 2014-12, but ugexe++ also verified on newer​:

# cat /tmp/A.pm6

role A [ :$bs where { True } = 512] { }
# PERL6LIB=/tmp/ perl6-m -e 'use A; class B does A[ ] { }; B.new;'
===SORRY!===
None of the parametric role variants for 'A' matched the arguments supplied.
Cannot modify an immutable Block
# emacs /tmp/A.pm6
# cat /tmp/A.pm6
role A [ :$bs where { True }
= 512] { }
# PERL6LIB=/tmp/ perl6-m -e 'use A; class B does A[ ] { }; B.new;'
#

For the subroutine signature problem, see​:

http://irclog.perlgeek.de/perl6/2015-01-19#i_9964933

They both boiled down to the same parsing problem. Fixed it, and added test coverage for both the sub case in S06-multi/type-based.t and the role case in S14-roles/parameterized-type.t.

@p6rt
Copy link
Author

p6rt commented Jun 20, 2015

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

@p6rt p6rt closed this as completed Jun 20, 2015
@p6rt
Copy link
Author

p6rt commented Jun 20, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant