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

Fwd: [rakudo] patch for better message when wrong syntax used for named parameter #1807

Closed
p6rt opened this issue Jun 7, 2010 · 4 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jun 7, 2010

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

Searchable as RT75588$

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

From @cognominal

Apparently sending to bitbucket is equivalent to >/dev/null

---------- Forwarded message ----------
From​: Stéphane Payrard <cognominal@​gmail.com>
Date​: Fri, Jun 4, 2010 at 1​:50 PM
Subject​: [rakudo] patch for better message when wrong syntax used for
named parameter
To​: bugs-bitbucket@​rt.perl.org

bash-3.2$ perl6

sub b($​:a) {...}
In signature parameter, placeholder variables like $​:a are illegal
you probably meant a named parameter​: '​:$a' at line 1, near ") {...}\n"

bash-3.2$ git diff src/Perl6/Actions.pm

Inline Patch
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index c5bbf63..6e892a4 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -1561,7 +1561,12 @@ method param_var($/) {
            }
        }
        elsif $twigil ne '!' && $twigil ne '.' && $twigil ne '*' {
-            $/.CURSOR.panic("Illegal to use $twigil twigil in signature");
+            my $error := "In signature parameter, '" ~ ~$/ ~ "', it
is illegal to use '" ~ $twigil ~ "' twigil"; \+            if $twigil eq '​:' \{ \+                $error := "In signature parameter, placeholder variables like " ~ ~$/ ~ " are illegal\\n" \+                           ~ "you probably meant a named parameter​: '​:" ~ $\ ~ ~$\\[0\] ~ "'"; \+            \} \+            $/\.CURSOR\.panic\($error\);         \}     \}  \}

--
cognominal stef

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

From @moritz

Thanks for the patch, applied as b258f5cc1633c4aa5035a3e5ba4c4dd076d50ee2.

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

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

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

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

@p6rt p6rt closed this as completed Jun 7, 2010
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