[Runtime] Preserve prototypes assigned before Math::Complex sub definitions
Les mainteneurs répondent en général sous 1 jour
Une pull request liée a déjà été fusionnée.
- #1726 par @fglock — fusionnée
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 57/100
Piste de recherche
Start with the prototype handling for forward subs and later body definitions, then add the focused regression test requested in the issue. Verify that the assigned prototype is preserved without a mismatch warning, matching system Perl. Finally, run Template-Toolkit's t/math_rand.t on PerlOnJava and confirm it passes without unrelated warnings.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
Loading core Math::Complex emits six false Prototype mismatch warnings, causing Template-Toolkit's t/math_rand.t warning assertion to fail.
Reproduction and evidence
On PerlOnJava commit 3893a1903799d49a4c0733bf231468bb6087cc13 (the PR base) and PR head 45c7c70903a79ab5ecbdbcc0c5a018613ef0b4a2, run:
timeout 1800 ./jcpan -t Template
Template-Toolkit 3.106 fails only t/math_rand.t (1 of 1 assertion). The assertion expects no warnings while calling rand/srand without arguments, but receives warnings such as Prototype mismatch: sub Math::Complex::abs (_) vs none at .../Math/Complex.pm line 694. The same failure and warning text reproduce on the pre-PR base, so this is independent of the MakeMaker changes in PR #1654.
The core src/main/perl/lib/Math/Complex.pm sets _ prototypes for abs, cos, exp, log, sin, and sqrt via Scalar::Util::set_prototype in its BEGIN block (around lines 99–106), then defines those subroutines without inline prototypes later in the file (for example sub abs {} around line 676). PerlOnJava treats the later body definitions as replacing the already-prototyped forward CV with a prototype-less CV and emits the (_) vs none mismatch warning. Perl preserves the prototype assigned to that CV; the definition should not clear it or warn.
Expected behavior
The six intentional Math::Complex overrides should retain their _ prototype without emitting mismatch warnings. Template's t/math_rand.t should see no unrelated warnings from loading Math::Complex.
Acceptance criteria
- Add a focused regression test for assigning a prototype to a forward sub and then defining its body without an inline prototype.
- Preserve the assigned prototype and avoid a false mismatch warning, matching system Perl.
- Confirm
Template::Toolkit'st/math_rand.tpasses on PerlOnJava.
- Langage dominant
- Perl
- Étoiles
- 64
- Forks
- 7
- Merge moyen
- 5 h 39 min
- PR mergées (30 j)
- 213
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de fglock/PerlOnJava
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
fglock/PerlOnJava#1579 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
fglock/PerlOnJava#1835 ·
Les mainteneurs répondent en général sous 1 jour
-
area:cpan-port bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
fglock/PerlOnJava#1820 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 Une demi-journée Accessibilité débutants 45/100
fglock/PerlOnJava#1808 ·
Les mainteneurs répondent en général sous 1 jour
-
area:cpan-port area:runtime bug
Difficulté 4/5 3-5 jours Accessibilité débutants 28/100
fglock/PerlOnJava#1802 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de fglock/PerlOnJava
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
jimsalterjrs/sanoid#1116 · 1 réaction ·
-
Add .gitattributes so share/skel keeps LF on a Windows git checkoutPeut-être pris @sadhana-s-codez l’a pris il y a 3 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
PerlDancer/Dancer2#1854 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
major/MySQLTuner-perl#1007 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100