mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
Allow :isa in class declaration without a block
Using class attributes in the unit class syntax was a syntax error. This change makes the following two lines equivalent:
class B :isa(A) ;
class B :isa(A) { }
Addresses GH issue #20888.
This commit is contained in:
parent
49830b9d6d
commit
edcf480ecf
1
AUTHORS
1
AUTHORS
@ -134,6 +134,7 @@ Aristotle Pagaltzis <pagaltzis@gmx.de>
|
||||
Arjen Laarhoven <arjen@nl.demon.net>
|
||||
Arkturuz <arkturuz@gmail.com>
|
||||
Arne Ahrend <aahrend@web.de>
|
||||
Arne Johannessen <ajnn@cpan.org>
|
||||
Arnold D. Robbins <arnold@gnu.ai.mit.edu>
|
||||
Art Green <Art_Green@mercmarine.com>
|
||||
Art Haas <ahaas@airmail.net>
|
||||
|
||||
2
perly.h
generated
2
perly.h
generated
@ -235,6 +235,6 @@ int yyparse (void);
|
||||
|
||||
|
||||
/* Generated from:
|
||||
* 404f5c053415e3ead8d5b0e39c35188e47e522bbccd25374bdcf5128f1b93ccc perly.y
|
||||
* 772de3ed75dc4010fd79a22e9c90253232ab5af632d3657c55a670d510ee71ef perly.y
|
||||
* acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
|
||||
* ex: set ro ft=C: */
|
||||
|
||||
5
perly.y
5
perly.y
@ -443,13 +443,16 @@ barestmt: PLUGSTMT
|
||||
package_version($version);
|
||||
$$ = NULL;
|
||||
}
|
||||
| KW_CLASS BAREWORD[version] BAREWORD[package] PERLY_SEMICOLON
|
||||
| KW_CLASS BAREWORD[version] BAREWORD[package] subattrlist PERLY_SEMICOLON
|
||||
{
|
||||
package($package);
|
||||
if ($version)
|
||||
package_version($version);
|
||||
$$ = NULL;
|
||||
class_setup_stash(PL_curstash);
|
||||
if ($subattrlist) {
|
||||
class_apply_attributes(PL_curstash, $subattrlist);
|
||||
}
|
||||
}
|
||||
| KW_USE_or_NO startsub
|
||||
{ CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
|
||||
|
||||
@ -366,6 +366,12 @@ manager will later use a regex to expand these into links.
|
||||
|
||||
=item *
|
||||
|
||||
In the new experimental C<class> feature, attributes are no longer a syntax
|
||||
error when using the unit class syntax.
|
||||
[GH #20888].
|
||||
|
||||
=item *
|
||||
|
||||
XXX
|
||||
|
||||
=back
|
||||
|
||||
@ -71,4 +71,14 @@ no warnings 'experimental::class';
|
||||
is($obj->x, "X", 'Constructor params passed through to superclass');
|
||||
}
|
||||
|
||||
{
|
||||
class Test4A { }
|
||||
|
||||
class Test4B :isa(Test4A);
|
||||
|
||||
package main;
|
||||
my $obj = Test4B->new;
|
||||
ok($obj isa Test4A, 'Unit class syntax allows :isa');
|
||||
}
|
||||
|
||||
done_testing;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user