A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatible

Đang mở
#558 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@CatarinaGamboa đang làm issue này rồi.

Từ ngày 24/11/2026.

  • #561 của @CatarinaGamboa — đang mở

Đá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
15/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
compilers

Hướng nghiên cứu

Start from the Tern reproducer in the issue, which uses a ternary over int[] branches checked against a length(a) == 1 refinement, and reproduce both the Sorts (Array Int Int) and Bool are incompatible error and the args not-found variant. The verifier code that handles conditional expressions is not named in the payload, so locate it by searching for the ternary handling. Work is already under way in linked pull request #561, so check that before starting. Done means the reproducer passes with each branch's facts holding under its condition.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Description
A conditional expression (c ? x : y) whose branches are arrays crashes the verifier when the result is checked against a length refinement.

Minimal reproducer

import liquidjava.specification.Refinement;

public class Tern {
    static void one(@Refinement("length(a) == 1") int[] a) {}

    static void pick(boolean b) {
        int[] a = b ? new int[1] : new int[1];
        one(a);   // should pass
    }
}

Result on main:

Error: Sorts (Array Int Int) and Bool are incompatible

If the condition mentions args (boolean b = args.length > 0; inside main), the same program instead fails with Not Found Error: Variable 'args' could not be found, which also only happens with the array ternary.

Expected
The program passes: both branches have length 1. A branch array's facts should hold for the result under that branch's condition. Found while reviewing #540.

Ngôn ngữ chính
Java
Star
73
Fork
38
Merge trung bình
12 giờ 32 phút
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của liquid-java/liquidjava

Tất cả issue của liquid-java/liquidjava

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.