mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
AK: Optional::operator bool() should consume the Optional
We use consumable annotations to catch bugs where you get the .value() of an Optional before verifying that it's okay. The bug here was that only has_value() would set the consumed state, even though operator bool() does the same job.
This commit is contained in:
parent
e75e33eb46
commit
a00419ed77
1 changed files with 1 additions and 0 deletions
|
@ -121,6 +121,7 @@ public:
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_TYPESTATE(consumed)
|
||||||
operator bool() const { return m_has_value; }
|
operator bool() const { return m_has_value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue