False error: a call used as an operand loses the link between its return refinement and its arguments
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 40/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 71
- Forks
- 36
- Merge medio
- 2 d 3 h
- PR fusionados (30 d)
- 45
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de liquid-java/liquidjava
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
liquid-java/liquidjava#395 ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
liquid-java/liquidjava#373 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
liquid-java/liquidjava#416 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
liquid-java/liquidjava#406 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
liquid-java/liquidjava#404 ·
Los mantenedores suelen responder en 2 días
Todos los issues de liquid-java/liquidjava
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
521xueweihan/HelloGitHub#4105 ·
-
Awaiting further input from submitter
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Regression in 5.9.0: CuratorCache fails with ClassCastException when the client is not a CuratorFrameworkBasePosiblemente ocupada @sftwnd la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día