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:
Andreas Kling 2019-08-24 21:45:32 +02:00
parent e75e33eb46
commit a00419ed77

View file

@ -121,6 +121,7 @@ public:
return fallback;
}
SET_TYPESTATE(consumed)
operator bool() const { return m_has_value; }
private: