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

Ouverte
#558 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@CatarinaGamboa y travaille déjà.

Depuis le 24/11/2026.

  • #561 par @CatarinaGamboa — ouverte

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
15/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
java
Domaine
compilers

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Java
Étoiles
73
Forks
38
Merge moyen
12 h 32 min
PR mergées (30 j)
45

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de liquid-java/liquidjava

Toutes les issues de liquid-java/liquidjava

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.