False error: a call used as an operand loses the link between its return refinement and its arguments
Maintainer antworten meist innerhalb von 2 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 40/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Java
- Sterne
- 67
- Forks
- 36
- Ø Merge
- 2 T. 2 Std.
- Gemergte PRs (30 T.)
- 34
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus liquid-java/liquidjava
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
liquid-java/liquidjava#395 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Verifier crashes on a comparison or other binary operator whose operand types cannot be resolved (classes not on the classpath)Evtl. vergeben @CatarinaGamboa hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
liquid-java/liquidjava#388 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
liquid-java/liquidjava#373 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Soundness: a local variable with a constant's name shadows the constant (Format.JPG read as local JPG)Evtl. vergeben @CatarinaGamboa hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
liquid-java/liquidjava#321 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 55/100
liquid-java/liquidjava#404 ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in liquid-java/liquidjava
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
objectionary/lints#1556 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
wildfly/wildfly-launcher#99 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
apache/rocketmq#11427 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
A failed JNA download is reported as a corrupt zip, because `curl` in `Makefile` lacks `--fail`Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
objectionary/phino#1884 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag