Skip to content

Commit

Permalink
Add experimental::qt warning
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed Jan 11, 2024
1 parent 6e74263 commit 406d3d3
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -6135,6 +6135,7 @@ t/lib/warnings/pp_ctl Tests for pp_ctl.c for warnings.t
t/lib/warnings/pp_hot Tests for pp_hot.c for warnings.t
t/lib/warnings/pp_pack Tests for pp_pack.c for warnings.t
t/lib/warnings/pp_sys Tests for pp_sys.c for warnings.t
t/lib/warnings/qt Tests for qt() syntax for warnings.t
t/lib/warnings/regcomp Tests for regcomp.c for warnings.t
t/lib/warnings/regexec Tests for regexec.c for warnings.t
t/lib/warnings/run Tests for run.c for warnings.t
Expand Down
27 changes: 17 additions & 10 deletions lib/warnings.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pod/perldiag.pod
Original file line number Diff line number Diff line change
Expand Up @@ -5535,6 +5535,12 @@ and then thrown away. Any prototypes or attributes are therefore
meaningless and are ignored. You should remove them from the C<BEGIN> block.
Note this also means you cannot create a constant called C<BEGIN>.

=item qt() is experimental

(S experimental::qt) This warning is emitted if you use the C<qt()>
templated quoting syntax. This quoting form is currently experimental and
its behaviour may change in future releases of Perl.

=item Quantifier follows nothing in regex; marked by S<<-- HERE> in m/%s/

(F) You started a regular expression with a quantifier. Backslash it if
Expand Down
4 changes: 3 additions & 1 deletion regen/warnings.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# This script is normally invoked from regen.pl.

$VERSION = '1.67';
$VERSION = '1.68';

BEGIN {
require './regen/regen_lib.pl';
Expand Down Expand Up @@ -159,6 +159,8 @@ BEGIN
[ 5.035, DEFAULT_ON],
'experimental::class' =>
[ 5.037, DEFAULT_ON ],
'experimental::qt' =>
[ 5.039, DEFAULT_ON ],
}],

'missing' => [ 5.021, DEFAULT_OFF],
Expand Down
7 changes: 7 additions & 0 deletions t/lib/warnings/qt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
toke.c warnings from parsing qt() syntax
__END__
# experimental warnings
use feature 'qt';
my $str = qt{this is a quoted template string};
EXPECT
qt() is experimental at - line 3.
1 change: 1 addition & 0 deletions t/op/qt.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BEGIN {
}

use feature 'qt';
no warnings 'experimental::qt';

# Literal quoting
is( qt{some literal text}, "some literal text", 'qt{} as literal' );
Expand Down
3 changes: 3 additions & 0 deletions toke.c
Original file line number Diff line number Diff line change
Expand Up @@ -8554,6 +8554,9 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct
TERM(sublex_start());

case KEY_qt:
Perl_ck_warner_d(aTHX_
packWARN(WARN_EXPERIMENTAL__QT),
"qt() is experimental");
// For now parse purely as a single q(). Code entirely stolen from KEY_q
s = scan_str(s,FALSE,FALSE,FALSE,NULL);
if (!s)
Expand Down
7 changes: 6 additions & 1 deletion warnings.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 406d3d3

Please sign in to comment.