mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 11:04:40 +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
|
@ -121,6 +121,7 @@ public:
|
|||
return fallback;
|
||||
}
|
||||
|
||||
SET_TYPESTATE(consumed)
|
||||
operator bool() const { return m_has_value; }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue