Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Soundness: short-circuit RHS assignments are treated as executed

未关闭
#323 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@CatarinaGamboa 已经在做这个了。

开始于 2026年10月2日。

  • #324 来自 @CatarinaGamboa —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
compilers

调研方向

Start at RefinementTypeChecker.visitCtBinaryOperator and reproduce the false && and true || cases from the issue. Compare current main with the conservative fix in PR #257, then verify both operators, nested writes, and branches where the RHS runs or is skipped. Done means the invalid refinement is rejected without rejecting valid executed-RHS cases.

由索引模型根据 Issue 内容生成。

描述

Problem

A write in the right operand of Java && or || is applied to LiquidJava's variable context even when Java short-circuits and does not execute that operand. The verifier can then prove a refinement about a value the program never assigned.

Minimal reproducer

import liquidjava.specification.Refinement;

public class Repro {
    public static void main(String[] args) {
        int x = 0;
        boolean ignored = false && ((x = 1) == 1);
        @Refinement("_ == 1") int y = x; // should be a Refinement Error
        assert y == 1;                    // fails: y is 0
    }
}

Expected: Reject the refinement on y. Java skips the RHS of &&, so x remains 0.

Actual: Correct! Passed Verification. on main at dd02e996. Compiling and running the program with assertions enabled throws AssertionError. The analogous true || RHS path has the same conditional-execution rule.

Cause and scope

RefinementTypeChecker.visitCtBinaryOperator scans both operands before applying the binary operation refinement. A RHS assignment updates the context during that scan; the later operator check does not distinguish a definitely executed write from a conditionally executed one.

The closed PR #257 contains a reproducer and a conservative fix. The fix should be ported and reviewed against current main, including both operators, nested writes, and branches where the RHS runs or is skipped. Example tests now use // Expect: Refinement Error after #293.

主要语言
Java
星标
67
派生
36
平均合并
3 天 16 小时
30 天内合并 PR
9

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

liquid-java/liquidjava 的其他 Issue

查看 liquid-java/liquidjava 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。