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

Aperta
#558 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@CatarinaGamboa ci sta già lavorando.

Dal 24/11/2026.

  • #561 di @CatarinaGamboa — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
73
Fork
38
Merge medio
12h 32m
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di liquid-java/liquidjava

Tutte le issue di liquid-java/liquidjava

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.