Alias arguments are substituted one at a time: Below(b, a) is expanded as a < a, giving a false "can never be true" warning
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- compilers, testing-qa
調査の方向性
Read Expression.changeAlias and the unsatisfiability check in TypeChecker; the issue identifies the sequential substitute call and provides a minimal Java reproducer. Check how PR #489 performs simultaneous substitution for the where lines, then verify that the reproducer no longer warns while run() passes and run2() is rejected.
索引モデルが issue の本文から書いたものです。
説明
Impact: an alias whose arguments reuse its own parameter names in a different order is expanded wrongly, because the arguments are substituted one at a time. At the declaration this gives a false "This refinement can never be true" warning. Call sites look right in this repro, because their arguments are renamed to fresh variables before the alias is expanded. Any other path that expands an alias over unrenamed names would check the wrong formula.
Minimal reproducer
import liquidjava.specification.Refinement;
import liquidjava.specification.RefinementAlias;
@RefinementAlias("Below(int a, int b) { a < b }")
public class Probe {
static void need(int a, int b, @Refinement("Below(b, a)") int unused) {}
static void run() {
need(5, 3, 0); // Below(3, 5) = 3 < 5: holds
}
static void run2() {
need(3, 5, 0); // Below(5, 3) = 5 < 3: must be rejected
}
}
Actual (main @ cd49fea3):
Warning: This refinement can never be true
6 | static void need(int a, int b, @Refinement("Below(b, a)") int unused) {}
| ^^^^^^^^^^^
Refinement Error: b == 5 && a == 3 is not a subtype of Below(b, a) (line 13, correct)
run() passes and run2() is rejected, both correct. The warning is wrong: b < a is satisfiable.
Cause. Expression.changeAlias builds the expansion with sub = sub.substitute(varExp, aliasExp) for each parameter in turn. For Below(b, a) with parameters (a, b): a < b becomes b < b after a := b, then a < a after b := a. The unsatisfiability check in TypeChecker expands the declared refinement with the parameters' own names, so it checks a < a.
Expected: substitute all arguments at once, i.e. a simultaneous substitution, or rename the alias parameters to fresh names first. Then the declaration gets no warning.
Found while working on #295 (PR #489 builds its expansions with a simultaneous substitution for the where lines, but does not change changeAlias).
- 主要言語
- Java
- スター
- 73
- フォーク
- 38
- 平均マージ
- 12時間 32分
- マージ済み PR(30日)
- 45
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
liquid-java/liquidjava のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
liquid-java/liquidjava#562 ·
メンテナーはふだん 1 日以内に返信
-
A float ghost crashes the verifier: "Ghost not implemented for type float"対応中かも @MohammedZaid1740 が 7 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
liquid-java/liquidjava#443 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug real-world-finding
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
liquid-java/liquidjava#395 ·
メンテナーはふだん 1 日以内に返信
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatible対応中かも @CatarinaGamboa が 4 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
liquid-java/liquidjava#558 ·
メンテナーはふだん 1 日以内に返信
-
new T[a][b] gets length b instead of a (unsound)対応中かも @CatarinaGamboa が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
liquid-java/liquidjava#557 ·
メンテナーはふだん 1 日以内に返信
liquid-java/liquidjava の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
quelea-projection/Quelea#749 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
erkamyaman/rust-anything#963 ·
メンテナーはふだん 1 日以内に返信
-
api-diagnostics bug jdbc
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ClickHouse/clickhouse-java#3464 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 76/100
-
Deferred
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Sanne/incus-spawn#2768 ·
メンテナーはふだん 1 日以内に返信