Commit d539094f authored by Marshall Cline's avatar Marshall Cline Committed by Facebook Github Bot

Fix doc-comment inconsistencies in class Promise

Summary:
Non-functional comment-only changes.

Goal: Adjust Promise's code-docs so they are consistent with Future and SemiFuture, e.g., change "valid() must be true" to "`valid() == true`"

Reviewed By: LeeHowes

Differential Revision: D9415137

fbshipit-source-id: dbb8df00919779b339e5b08337eba0df1a210ac2
parent 25c2411f
...@@ -145,24 +145,24 @@ class Promise { ...@@ -145,24 +145,24 @@ class Promise {
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// RESULT.valid() will be false /// - `RESULT.valid() == false`
/// RESULT.isFulfilled() will be true /// - `RESULT.isFulfilled() == true`
static Promise<T> makeEmpty() noexcept; static Promise<T> makeEmpty() noexcept;
/// Constructs a valid but unfulfilled promise. /// Constructs a valid but unfulfilled promise.
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - valid() will be true (it will have a shared state) /// - `valid() == true` (it will have a shared state)
/// - isFulfilled() will be false (its shared state won't have a result) /// - `isFulfilled() == false` (its shared state won't have a result)
Promise(); Promise();
/// Postconditions: /// Postconditions:
/// ///
/// - If valid() and !isFulfilled(), the associated future (if any) will be /// - If `valid()` and `!isFulfilled()`, the associated future (if any) will
/// completed with a `BrokenPromise` exception *as if* by /// be completed with a `BrokenPromise` exception *as if* by
/// `setException(...)`. /// `setException(...)`.
/// - If valid(), releases, possibly destroying, the shared state. /// - If `valid()`, releases, possibly destroying, the shared state.
~Promise(); ~Promise();
// not copyable // not copyable
...@@ -182,10 +182,10 @@ class Promise { ...@@ -182,10 +182,10 @@ class Promise {
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - If valid() and !isFulfilled(), the associated future (if any) will be /// - If `valid()` and `!isFulfilled()`, the associated future (if any) will
/// completed with a `BrokenPromise` exception *as if* by /// be completed with a `BrokenPromise` exception *as if* by
/// `setException(...)`. /// `setException(...)`.
/// - If valid(), releases, possibly destroying, the original shared state. /// - If `valid()`, releases, possibly destroying, the original shared state.
/// - `this` will have whatever shared-state was previously held by `other` /// - `this` will have whatever shared-state was previously held by `other`
/// (if any) /// (if any)
/// - `other.valid()` will be false (`other` will not have any shared state) /// - `other.valid()` will be false (`other` will not have any shared state)
...@@ -196,13 +196,13 @@ class Promise { ...@@ -196,13 +196,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - neither getSemiFuture() nor getFuture() may have been called previously /// - neither getSemiFuture() nor getFuture() may have been called previously
/// on `this` Promise (else throws FutureAlreadyRetrieved) /// on `this` Promise (else throws FutureAlreadyRetrieved)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - RESULT.valid() will be true /// - `RESULT.valid() == true`
/// - RESULT will share the same shared-state as `this` /// - RESULT will share the same shared-state as `this`
/// ///
/// DEPRECATED: use `folly::makePromiseContract()` instead. /// DEPRECATED: use `folly::makePromiseContract()` instead.
...@@ -213,13 +213,13 @@ class Promise { ...@@ -213,13 +213,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - neither getSemiFuture() nor getFuture() may have been called previously /// - neither getSemiFuture() nor getFuture() may have been called previously
/// on `this` Promise (else throws FutureAlreadyRetrieved) /// on `this` Promise (else throws FutureAlreadyRetrieved)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - RESULT.valid() will be true /// - `RESULT.valid() == true`
/// - RESULT will share the same shared-state as `this` /// - RESULT will share the same shared-state as `this`
/// ///
/// DEPRECATED: use `folly::makePromiseContract()` instead. If you can't use /// DEPRECATED: use `folly::makePromiseContract()` instead. If you can't use
...@@ -241,13 +241,13 @@ class Promise { ...@@ -241,13 +241,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - !isFulfilled() (else throws PromiseAlreadySatisfied) /// - `isFulfilled() == false` (else throws PromiseAlreadySatisfied)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - isFulfilled() will be true /// - `isFulfilled() == true`
/// - valid() will be unchanged (true) /// - `valid() == true` (unchanged)
/// - The associated future (if any) will complete with the exception. /// - The associated future (if any) will complete with the exception.
void setException(exception_wrapper ew); void setException(exception_wrapper ew);
...@@ -276,7 +276,7 @@ class Promise { ...@@ -276,7 +276,7 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - `fn` must be copyable and must be invocable with /// - `fn` must be copyable and must be invocable with
/// `exception_wrapper const&` /// `exception_wrapper const&`
/// - the code within `fn()` must be safe to run either synchronously within /// - the code within `fn()` must be safe to run either synchronously within
...@@ -314,13 +314,13 @@ class Promise { ...@@ -314,13 +314,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - !isFulfilled() (else throws PromiseAlreadySatisfied) /// - `isFulfilled() == false` (else throws PromiseAlreadySatisfied)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - isFulfilled() will be true /// - `isFulfilled() == true`
/// - valid() will be unchanged (true) /// - `valid() == true` (unchanged)
template <class B = T> template <class B = T>
typename std::enable_if<std::is_same<Unit, B>::value, void>::type typename std::enable_if<std::is_same<Unit, B>::value, void>::type
setValue() { setValue() {
...@@ -333,13 +333,13 @@ class Promise { ...@@ -333,13 +333,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - !isFulfilled() (else throws PromiseAlreadySatisfied) /// - `isFulfilled() == false` (else throws PromiseAlreadySatisfied)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - isFulfilled() will be true /// - `isFulfilled() == true`
/// - valid() will be unchanged (true) /// - `valid() == true` (unchanged)
/// - The associated future will see the value, e.g., in its continuation. /// - The associated future will see the value, e.g., in its continuation.
template <class M> template <class M>
void setValue(M&& value); void setValue(M&& value);
...@@ -348,13 +348,13 @@ class Promise { ...@@ -348,13 +348,13 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - !isFulfilled() (else throws PromiseAlreadySatisfied) /// - `isFulfilled() == false` (else throws PromiseAlreadySatisfied)
/// ///
/// Postconditions: /// Postconditions:
/// ///
/// - isFulfilled() will be true /// - `isFulfilled() == true`
/// - valid() will be unchanged (true) /// - `valid() == true` (unchanged)
/// - The associated future will see the result, e.g., in its continuation. /// - The associated future will see the result, e.g., in its continuation.
void setTry(Try<T>&& t); void setTry(Try<T>&& t);
...@@ -369,8 +369,8 @@ class Promise { ...@@ -369,8 +369,8 @@ class Promise {
/// ///
/// Preconditions: /// Preconditions:
/// ///
/// - valid() (else throws PromiseInvalid) /// - `valid() == true` (else throws PromiseInvalid)
/// - !isFulfilled() (else throws PromiseAlreadySatisfied) /// - `isFulfilled() == false` (else throws PromiseAlreadySatisfied)
/// ///
/// Postconditions: /// Postconditions:
/// ///
...@@ -379,8 +379,8 @@ class Promise { ...@@ -379,8 +379,8 @@ class Promise {
/// `setValue()` /// `setValue()`
/// - If `func()` throws, the exception will be captured as if via /// - If `func()` throws, the exception will be captured as if via
/// `setException()` /// `setException()`
/// - isFulfilled() will be true /// - `isFulfilled() == true`
/// - valid() will be unchanged (true) /// - `valid() == true` (unchanged)
/// - The associated future will see the result, e.g., in its continuation. /// - The associated future will see the result, e.g., in its continuation.
template <class F> template <class F>
void setWith(F&& func); void setWith(F&& func);
...@@ -393,8 +393,8 @@ class Promise { ...@@ -393,8 +393,8 @@ class Promise {
/// True if either this promise was fulfilled or is invalid. /// True if either this promise was fulfilled or is invalid.
/// ///
/// - True if !valid() /// - True if `!valid()`
/// - True if valid() and this was fulfilled (a prior call to `setValue()`, /// - True if `valid()` and this was fulfilled (a prior call to `setValue()`,
/// `setTry()`, `setException()`, or `setWith()`) /// `setTry()`, `setException()`, or `setWith()`)
bool isFulfilled() const noexcept; bool isFulfilled() const noexcept;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment