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

Offen
#509 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
54/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
java

Rechercherichtung

Start by tracing how @Refinement is checked on a method body and how the return refinement's this reference is represented when the return statement is checked. Compare that path with the external spec case described for Scanner.hasNext(). Done means the ordinary class example compiles with the stated refinement while the existing external spec behavior still works.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

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.

Vorherrschende Sprache
Java
Sterne
73
Forks
38
Ø Merge
12 Std. 32 Min.
Gemergte PRs (30 T.)
45

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus liquid-java/liquidjava

Alle Issues in liquid-java/liquidjava

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.