Counterexample: a guard stored in a boolean (boolean bad = a || b || c; if (bad) return;) is not split, so every variable of the guard is listed
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start by reading RefinementError.factsOf and how boolean definitions and negated facts are handled; the issue identifies linkedTerms and isKnown as relevant. Run the supplied Java reproducer and compare its counterexample with the expected timeout == -1. Done when the stored-boolean guard produces the expected minimal counterexample without unrelated guard variables or the generated name.
由索引模型根據 Issue 內容生成。
描述
Impact: when a guard is stored in a boolean before the if, the counterexample lists values for every variable of the guard and for a generated name, instead of only the value that breaks the call. Seen on the branch of #460 (pending merge), which fixes this for an inline guard; on main the counterexample for this input has the same noise and also leaves out timeout (#453).
Minimal reproducer
import liquidjava.specification.Refinement;
public class Probe {
static void connect(@Refinement("_ >= 0") int timeout) {}
static void probe(int port, int retries, int timeout) {
boolean bad = port < 0 || retries < 0 || timeout > 60000;
if (bad) return;
connect(timeout);
}
}
Expected: Counterexample: timeout == -1, as with the inline guard if (port < 0 || retries < 0 || timeout > 60000) return;, which on #460's branch (712759fe) gives:
Refinement Error: !(port < 0 || retries < 0 || timeout > 60000) is not a subtype of timeout >= 0
--> Counterexample: timeout == -1
Actual (#460's branch @ 712759fe):
Refinement Error: #fresh⁹ == (port < 0 || retries < 0 || timeout > 60000) && !#fresh⁹ is not a subtype of timeout >= 0
7 | boolean bad = port < 0 || retries < 0 || timeout > 60000;
8 | if (bad) return;
9 | connect(timeout);
| ^^^^^^^^^^^^^^^^^
10 | }
11 | }
--> Counterexample: timeout == -1 && port == 0 && retries == 0 && #fresh⁹ == false
main @ 0053074e prints the same Found with Counterexample: port == 0 && retries == 0 && #fresh⁹ == false.
Cause. On #460's branch, RefinementError.factsOf splits !(a || b) into !a and !b, but here found is #fresh == (a || b || c) && !#fresh. The definition is one fact that shares terms with everything, so linkedTerms pulls in port, retries and #fresh. isKnown only recognises x == v facts, so !#fresh does not hide #fresh == false. Substituting a boolean defined as x == e into !x (giving !e) before splitting would give the same facts as the inline guard. Separately, found names the local bad as #fresh⁹.
🤖 Generated with Claude Code
- 主要語言
- Java
- 星號
- 71
- 分支
- 37
- 平均合併
- 1 天 19 小時
- 30 天內合併 PR
- 46
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
liquid-java/liquidjava 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
liquid-java/liquidjava#443 ·
維護者通常 2 天內回覆
-
bug real-world-finding
難度 2/5 1-3 小時 新手友好度 82/100
liquid-java/liquidjava#395 ·
維護者通常 2 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 65/100
liquid-java/liquidjava#373 ·
維護者通常 2 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 69/100
liquid-java/liquidjava#470 ·
維護者通常 2 天內回覆
-
bug error messages
難度 3/5 1-2 天 新手友好度 68/100
liquid-java/liquidjava#469 ·
維護者通常 2 天內回覆
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
Dans-Plugins/Medieval-Roleplay-Engine#396 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 1 天內回覆
-
LtByXsl throws NoSuchElementException when defect element has no text content可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
objectionary/lints#1640 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 72/100
virtualcell/vcell#2193 ·
維護者通常 1 天內回覆