Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Imported Language::Functional break subroutine is parsed as an operator

未关闭
#1,430 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java, perl
领域
backend, compilers

调研方向

从 t/simple.t 第 77 行的 upstream 复现开始,并查看在两个后端上复现该问题的项目专项回归。跟踪导入的子程序名称与运算符重叠时它们是如何解析的,然后运行 JVM 和解释器测试。当 break { ... } $list 能在两个后端上完成解析并执行、真正的运算符仍能正常工作,且 upstream 的 97 项测试套件全部通过时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

area:cpan-port area:parser bug

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.t passes 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 break can be called in the upstream form break { ... } $list on both JVM and interpreter backends.
  • Language::Functional 0.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.t line 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::time failing to override the built-in time operator. 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。