Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

False error: a call used as an operand loses the link between its return refinement and its arguments

オープン
#405 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
40/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
devtools

調査の方向性

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 の本文から書いたものです。

説明

bug

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

liquid-java/liquidjava のほかの issue

liquid-java/liquidjava の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。