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
LTA error message for mistaken uses of '.' for concatenation in Rakudo #2166
Comments
From @masak<masak> std: "foo" . "bar" |
From @timoI made a patch that fixes this: > "foo"."bar" I'm wondering, if a testcase should be written to check for a helpful |
From @timo0001-warn-about-obsolete-use-of-.-to-concatenate-strings.patchFrom 1d8320e1037855e9a90f987ec6649cc73247e60d Mon Sep 17 00:00:00 2001
From: Timo Paulssen <timonator@perpetuum-immobile.de>
Date: Thu, 13 Dec 2012 00:33:44 +0100
Subject: [PATCH] warn about obsolete use of . to concatenate strings.
---
src/Perl6/Grammar.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index 6cd0123..f9a6e70 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -2896,7 +2896,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
| <?before <[ ' " ]> >
[ <!{$*QSIGIL}> || <!before '"' <-["]>*? \s > ] # dwim on "$foo."
<quote>
- [ <?before '(' | '.(' | '\\'> || <.panic: "Quoted method name requires parenthesized arguments"> ]
+ [ <?before '(' | '.(' | '\\'> || <.panic: "Quoted method name requires parenthesized arguments. If you meant to concatenate two strings, use '~'."> ]
] <.unsp>?
:dba('method arguments')
[
@@ -3008,6 +3008,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token infix:sym<xx> { <sym> >> <O('%replication')> }
token infix:sym<~> { <sym> <O('%concatenation')> }
+ token infix:sym<.> { '.' <[\]\)\},:\s\$"']> <.obs('. to concatenate strings', '~')> }
token infix:sym<&> { <sym> <O('%junctive_and')> }
token infix:sym<|> { <sym> <O('%junctive_or')> }
--
1.7.10.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @moritzThanks, I've applied your patch, with a small modification: instead of
I've added one to t/spec/S32-exceptions/misc.t that checks for X::Obsolete. As for the other one, the proper way to test it is to change it to a Cheers, |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#77856 (status was 'resolved')
Searchable as RT77856$
The text was updated successfully, but these errors were encountered: