False error: a call used as an operand loses the link between its return refinement and its arguments
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with OperationsChecker, the invocation case for operand refinements, and see how it calls RefinedFunction.getRenamedRefinements, which renames parameters to their last instances. Compare with MethodsFunctionsChecker, which maps arguments to parameters, and reproduce with the Inc class from the issue. Done means inc(2) + 1 and size(arr) + 1 verify while the direct assignment cases still pass.
索引モデルが issue の本文から書いたものです。
説明
Impact: correct code is rejected (false error) whenever a method's return refinement mentions its parameters and the call is an operand of an expression. Found while addressing a review comment on #400.
Description
OperationsChecker (the invocation case of operand refinements) takes the function's refinements via RefinedFunction.getRenamedRefinements, which renames each parameter to its last instance rather than to the call's arguments. When the call is an operand (inc(2) + 1), the parameters are never bound to the arguments, so the return refinement keeps the bare parameter name. The same call assigned directly (int k = inc(2);) works.
Minimal reproducer
import liquidjava.specification.Refinement;
class Inc {
@Refinement("_ == x + 1")
static int inc(int x) { return x + 1; }
@Refinement("_ == length(xs)")
static int size(int[] xs) { return xs.length; }
void m() {
@Refinement("_ == 4") int k = inc(2) + 1;
int[] arr = new int[2];
@Refinement("_ == 3") int j = size(arr) + 1;
}
}
Expected
Correct! Passed Verification.
Actual (main ad055b49)
Refinement Error: k⁷ == x + 2 is not a subtype of k⁷ == 4
Possible fix
For an invocation operand, check the call like a standalone invocation (MethodsFunctionsChecker, which maps arguments to parameters, including spread varargs since #400) and use the resulting refinement of the call, instead of the function's refinements with parameters renamed to their last instances.
- 主要言語
- Java
- スター
- 69
- フォーク
- 36
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 35
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
liquid-java/liquidjava のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
liquid-java/liquidjava#395 ·
メンテナーはふだん 2 日以内に返信
-
Verifier crashes on a comparison or other binary operator whose operand types cannot be resolved (classes not on the classpath)対応中かも @CatarinaGamboa が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
liquid-java/liquidjava#388 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
liquid-java/liquidjava#373 ·
メンテナーはふだん 2 日以内に返信
-
Soundness: a local variable with a constant's name shadows the constant (Format.JPG read as local JPG)対応中かも @CatarinaGamboa が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
liquid-java/liquidjava#321 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
liquid-java/liquidjava#406 ·
メンテナーはふだん 2 日以内に返信
liquid-java/liquidjava の issue をすべて見る
似ている issue
-
False Negative: InnerTypeLastCheck does not report members declared after inner enums or annotationsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
checkstyle/checkstyle#22027 ·
メンテナーはふだん 1 日以内に返信
-
bug follow-up lane:auto
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Sanne/incus-spawn#1497 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339対応中かも @teovillanueva が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OpenAPITools/openapi-generator#25297 ·
メンテナーはふだん 1 日以内に返信
-
[CI] NettyClientTest.testServerDisconnection may fail with DisconnectException対応中かも @yangshangqing95 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信