Imported Language::Functional break subroutine is parsed as an operator
还没有人认领这个 Issue。
评估
调研方向
从 t/simple.t 第 77 行的 upstream 复现开始,并查看在两个后端上复现该问题的项目专项回归。跟踪导入的子程序名称与运算符重叠时它们是如何解析的,然后运行 JVM 和解释器测试。当 break { ... } $list 能在两个后端上完成解析并执行、真正的运算符仍能正常工作,且 upstream 的 97 项测试套件全部通过时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Language::Functional 0.05 fails under PerlOnJava because its exported break function is parsed as a built-in operator instead of being resolved as the imported Perl subroutine.
Reproduction
The upstream test t/simple.t imports all functions from Language::Functional and calls:
use Language::Functional ':all';
ok(eval {show(break { shift() >= 4 } [1..6])},
'[[1, 2, 3], [4, 5, 6]]');
Language::Functional defines and exports break as a normal Perl subroutine with prototype (&$).
Expected result
System Perl passes the complete upstream suite:
- 2 test files
- 97 tests
t/simple.tpasses all 96 tests
Actual result
The archived CPAN run fails during compilation at t/simple.t line 77, before the planned assertions execute:
JVM backend:
Operator "break" doesn't have a defined JVM descriptor at t/simple.t line 77, near ""
Interpreter backend:
Unsupported operator: break at t/simple.t line 77, near ""
The focused test reproduces this failure on both backends. The failure is recorded under target label InfiniteList, but the failing distribution is Language::Functional 0.05.
Likely root cause
PerlOnJava reserves or dispatches break as an operator before considering the imported subroutine installed by use Language::Functional ':all'. Standard Perl resolves this source form to the imported function, including its (&$) prototype and block argument.
This is a parser/symbol-resolution compatibility defect involving imported subroutines whose names overlap with built-in or feature-related operators. It is pure Perl and does not involve XS code, native libraries, or external services.
Acceptance criteria
- An imported subroutine named
breakcan be called in the upstream formbreak { ... } $liston both JVM and interpreter backends. Language::Functional0.05 passes all 97 upstream tests without modifying its tests.- Add focused project-owned regression coverage for an imported subroutine shadowing or overriding a built-in/feature-related operator name.
- Preserve genuine operator behavior when no overriding subroutine is imported.
- Preserve prototype-aware parsing of the block argument.
Evidence
- CPAN run:
20260918-141920-96054 - Distribution:
Language-Functional-0.05 - Failing test:
t/simple.tline 77,break { shift() >= 4 } [1..6] - System Perl: PASS, 2 files / 97 tests
- PerlOnJava: FAIL before assertions in
t/simple.t - JVM and interpreter: focused failure reproduced
Related issues
- #19 tracks imported
Time::HiRes::timefailing to override the built-intimeoperator. It is closed and concerns a different operator, but the import-vs-core-operator resolution problem is related. - #1257 tracks symbol-resolution collisions between imported constants and lexical declarations. It is open and related to preserving Perl namespaces and imported symbol identity, but it does not cover operator-shaped subroutine calls.
This issue should be coordinated with those efforts while retaining Language::Functional as independent regression coverage.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 6
- 平均合并
- 5 小时 38 分钟
- 30 天内合并 PR
- 170
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port area:unicode bug
难度 2/5 1-3 小时 新手友好度 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1508 · 1 条评论 ·
-
area:cpan-port area:platform enhancement
难度 5/5 一周以上 新手友好度 30/100
fglock/PerlOnJava#1507 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1506 ·
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
documentation Needs Triage
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
trizen/youtube-viewer#456 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
connectivity 未关闭
难度 1/5 1 小时以内 新手友好度 80/100
-
Common US ingredient names are not recognized, so about 12.4k US products miss an allergen warning 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
openfoodfacts/openfoodfacts-server#14657 · 4 条评论 ·