[Runtime] Preserve prototypes assigned before Math::Complex sub definitions
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #1726 来自 @fglock —— 已合并
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 7
- 平均合并
- 5 小时 6 分钟
- 30 天内合并 PR
- 200
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
fglock/PerlOnJava#1651 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
fglock/PerlOnJava#1579 ·
维护者通常 1 天内回复
-
area:cpan-port area:unicode bug
难度 2/5 1-3 小时 新手友好度 88/100
fglock/PerlOnJava#1341 ·
维护者通常 1 天内回复
-
area:parser bug
难度 4/5 3-5 天 新手友好度 49/100
fglock/PerlOnJava#1763 ·
维护者通常 1 天内回复
-
难度 3/5 半天 新手友好度 68/100
fglock/PerlOnJava#1735 ·
维护者通常 1 天内回复
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 3 天内回复
-
documentation Needs Triage
难度 1/5 1 小时以内 新手友好度 93/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
curl/everything-curl#658 ·
-
难度 1/5 1 小时以内 新手友好度 82/100
PDLPorters/pdl#561 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
objectionary/eolang.sty#197 ·
维护者通常 2 天内回复