Skip to content

False error: a boolean query (_ == true --> open(this)) in a class fails at its return #509

Open

Description

@CatarinaGamboa

Problem. A boolean query in an ordinary class, a method whose return refinement relates its result to the state of this, fails when its body is checked:

import liquidjava.specification.*;

@StateSet({"unlocked", "locked"})
public class QueryShorthand {
    @StateRefinement(to = "locked(this)")
    public QueryShorthand() {}

    @Refinement("_ == true --> unlocked(this)")
    public boolean isUnlocked() {
        return true;
    }
}
Argument Mismatch Error: Argument '#ret_1' and its respective parameter of ghost 'QueryShorthand.state1' types are incompatible: expected QueryShorthand, got boolean

The same refinement works on an external spec (_ == true --> hasMore(this) on Scanner.hasNext()), whose methods have no body. When the return is checked, the state's argument seems to become the returned value instead of this.

Found while writing tests for #502.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions