Prototype (&;@) calls consume following fat-comma chains
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start by reading PrototypeArgs.parsePrototypeArguments around the & handler and handleListOrHashArgument in src/main/java/org/perlonjava/frontend/parser/PrototypeArgs.java, then run the reproducer from the issue on both backends to see the failure near from Str. Trace how needComma propagates into the optional @ slurpy slot and decide when the list parse must stop at a => boundary. Done means the reproducer parses without parentheses, existing prototype behavior with real commas still works, and a new regression test is validated against system Perl and both PerlOnJava backends.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
PerlOnJava rejects a valid chained coercion declaration when an unparenthesized call with an ampersand-and-slurpy prototype is followed by a fat-comma chain. This prevents Types::XMLSchema 0.01 from loading on both JVM and interpreter backends.
Minimal reproducer
sub coerce { }
sub from (@) { }
sub via (&;@) { }
coerce X => from Int, via { 1 } => from Str, via { 2 };
print "ok\n";
System Perl accepts this and prints ok. PerlOnJava reports a syntax error near from Str. Parenthesizing the callback call as via({ 1 }) allows the corresponding chain to parse.
Root cause
Type::Utils::via has prototype (&;@). In PrototypeArgs.parsePrototypeArguments, the & handler parses a block and returns false for needComma. The following optional @ slot then calls handleListOrHashArgument. That method only requires a comma when needComma is true; with false, it parses a list starting at the outer => and consumes the next coercion clause as part of via's arguments. Parsing then fails at from Str.
The relevant code is in PrototypeArgs.java and handleListOrHashArgument. The parser source at the runtime's build commit is identical to the current source.
CPAN evidence
- Distribution:
Types-XMLSchema-0.01, run20261119-133823-51077. - System Perl oracle passed all 34 tests. PerlOnJava failed
t/00-compile.t,t/00-load.t, andt/types-xmlschema.twhile loadingTypes/XMLSchema.pmat line 89. - The reduced reproducer fails on both JVM and interpreter backends; the equivalent parenthesized call parses on both.
- This distribution is pure Perl; no XS dependency or reverse-dependency count applies.
- Related issue #1744 covers a separate
Type::Library extendsfailure on the interpreter and does not explain this parse error.
Environment and source identity
The PerlOnJava runtime reports Perl 5.44.1 and was built from commit 2de296a36d1b90e39241eab4c04fb2d93a179737; the current source checkout is 18742b1bf3acb794786a8dec51ec8f166aee6fb6, with the relevant parser files unchanged between them. The archived system-Perl oracle used Perl 5.42.2. The reproduction host is macOS arm64 with Java 24.0.2.
Acceptance criteria
- Parse the reproducer above without parentheses on both backends.
- Keep the optional slurpy prototype argument behavior correct when a comma actually introduces arguments.
- Add project-owned regression coverage, validate its Perl semantics with system Perl, and run it on both PerlOnJava backends.
- Confirm
Types-XMLSchema-0.01loads and its focused upstream tests pass after the fix.
- Ngôn ngữ chính
- Perl
- Star
- 67
- Fork
- 8
- Merge trung bình
- 5 giờ 12 phút
- Pull request đã merge (30 ngày)
- 131
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fglock/PerlOnJava
-
area:cpan-port bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fglock/PerlOnJava#2153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port area:parser bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fglock/PerlOnJava#2137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:backend area:cpan-port area:runtime bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fglock/PerlOnJava#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#1579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
fglock/PerlOnJava#2157 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksĐang mởteam-cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
inverse-inc/packetfence#9728 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(char-create): show the real reason a character is refusedCó thể đã có người làm @baphomello đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày