False error: a break nested inside a switch case forgets that path's state (Found shows true)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- testing-qa
Direzione di ricerca
Start by reading the switch and control flow handling added in #497, especially how loop exits collect state at break and yield. Trace the nested-break example through the verifier and identify where each exit context should join the case end states. Done means the example compiles without a state refinement error and the reported true path is preserved correctly.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up to #494 / #497. With switch cases modelled, a break nested inside a case (for example inside an if) is not followed: the state at that break is dropped, so after the switch the verifier knows nothing about that path. Correct code is rejected, and the message shows a bare true.
@StateSet({"closed", "open"})
class Door {
@StateRefinement(to = "closed(this)") Door() {}
@StateRefinement(from = "closed(this)", to = "open(this)") void open() {}
@StateRefinement(from = "open(this)", to = "closed(this)") void close() {}
}
class NestedBreak {
// Every path opens the door before leaving the switch, so close() is fine
static void enter(int k, boolean fast) {
Door d = new Door();
switch (k) {
case 1:
if (fast) {
d.open();
break;
}
d.open();
break;
default:
d.open();
}
d.close();
}
}
On the #497 branch (432a508c):
State Refinement Error: found k == 1 ? true : open(d) but expected open(d)
31 | d.close();
Hints:
- d can be in closed or open here, depending on the path taken, and no sequence of calls moves all of them to open. Make d reach this line in the same state on every path
Expected: no error. The true means "forgotten", which users are not told, and the hint describes a split that does not exist.
Fix direction: record the context at each nested break / yield and join it with the cases' end states, as loops already do for their exits.
Not needed for the error-message study (no study exercise has this shape after a switch).
- Lingua principale
- Java
- Stelle
- 73
- Fork
- 38
- Merge medio
- 12h 32m
- PR unite (30g)
- 45
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di liquid-java/liquidjava
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
liquid-java/liquidjava#562 ·
I maintainer di solito rispondono entro 1 giorno
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Forse già presa @MohammedZaid1740 l’ha presa 7 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
liquid-java/liquidjava#443 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug real-world-finding
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
liquid-java/liquidjava#395 ·
I maintainer di solito rispondono entro 1 giorno
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatibleForse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
liquid-java/liquidjava#558 ·
I maintainer di solito rispondono entro 1 giorno
-
new T[a][b] gets length b instead of a (unsound)Forse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
liquid-java/liquidjava#557 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di liquid-java/liquidjava
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
quelea-projection/Quelea#749 ·
I maintainer di solito rispondono entro 1 giorno
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#963 ·
I maintainer di solito rispondono entro 1 giorno
-
api-diagnostics bug jdbc
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ClickHouse/clickhouse-java#3464 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
-
Deferred
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Sanne/incus-spawn#2768 ·
I maintainer di solito rispondono entro 1 giorno