Interpreter bypasses overloaded logical negation
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 47/100
Hướng nghiên cứu
Start with CompileOperator.visitOperator, the interpreter’s NOT handler, and MathOperators.not()/Overload.bool_not() to trace how overloaded negation differs across backends. First run the focused reproducer and the unchanged Math-Logic 1.19 t/logic.t suite on system Perl, the JVM backend, and the interpreter. Done means a project regression passes on both backends, raw negation still works under no overloading, and all 332 upstream assertions pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Math::Logic 1.19's upstream t/logic.t fails five assertions under PerlOnJava when negating overloaded objects with !. System Perl passes the complete suite. A focused reproducer confirms that the PerlOnJava interpreter returns a plain boolean instead of invoking the class's overloaded ! method.
Evidence
- CPAN random-tester run:
20261119-133823-51077. - Distribution: pure-Perl
Math-Logic1.19; no XS/native dependency. - System Perl 5.42.2:
t/logic.tpasses all 332 tests. - PerlOnJava: 5/332 tests fail (tests 230, 260, 278–280), all in
!assertions for three-valued or multi-valued logic. The same failures reproduce with the JVM-default launcher and--interpreteron source543f9dfef. - Focused reducer: system Perl and the JVM backend return a
Math::Logicobject for the overloaded negation; the interpreter returns a scalar and fails the result-type/value assertion.
use Math::Logic qw($UNDEF);
my $x = Math::Logic->new(-value => $UNDEF, -degree => 3, -propagate => 1);
my $negated = !$x;
die "expected Math::Logic result\n"
unless ref($negated) eq 'Math::Logic' && $negated == $UNDEF;
Root cause
The interpreter compiler emits Opcodes.NOT when overloading is enabled (CompileOperator.visitOperator). The interpreter's NOT handler currently calls RuntimeScalar.getBoolean() and stores a cached plain true/false scalar. It does not route through MathOperators.not() or Overload.bool_not(), so it skips the (! overload. NOT_NO_OVERLOAD is a separate opcode and should remain the raw-boolean path.
The JVM implementation routes logical negation through MathOperators.not(), which calls Overload.bool_not() for overloaded values. The focused JVM reducer passes, but the complete upstream test still fails five assertions through the default launcher. That state-dependent full-suite failure must also be reduced and resolved before claiming distribution compatibility.
Acceptance criteria
- Add a project-owned regression for overloaded
!, validate it with system Perl first, and make it pass on the JVM and interpreter. - Preserve raw boolean behavior under
no overloading. - Reduce and resolve the five full-suite failures, including the discrepancy between the passing focused JVM case and failing
t/logic.trun. - Pass the unchanged
Math-Logic1.19t/logic.tsuite (332/332) on both PerlOnJava backends.
Related issue search
No existing issue was found for overloaded unary !. #2074 covers separate Set::Scalar parser and binary-operation failures; #2007 covers recursive re-dispatch of an active overload handler.
- 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