liquid-java/liquidjava

Change `return` to `$result` for method return values in refinements

Open

#133 opened on Dec 10, 2025

 (3 comments) (0 reactions) (0 assignees)Java (36 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (66 stars)
PR merge metrics
 (PR metrics pending)

Description

return is a statement, and it's strange to have it as a variable to represent the return value. Therefore, we could change it for result. But since result can be an actual variable that represents something other than the return value we, we can try using $result.

This would mean a small change in the grammar, probably, and a change in replacing the return value. Ps: the _ should still work in any case

Example Before:

@Refinement("return > 0") 
int test2 (){
    return 10;
}

Example After:

@Refinement("$result > 0") 
int test2 (){
    return 10;
}

Contributor guide