From e9907112b47255d50b4d343e7e2160bce8dc85d1 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 20 Feb 2026 07:09:50 -0800 Subject: [PATCH] Update doc for Optional. Change a mention of Eq(Optional(nullopt)) to Optional(Eq(nullopt)). Optional is supposed to wrap matchers, not values. For example, Optional("bla") doesn't compile but Optional(std::string("bla")) does. Optional(Eq("bla")) is the functionally correct version. Eq() cannot wrap a matcher. PiperOrigin-RevId: 872885639 Change-Id: I941f515308fa419162998073f6da9731fcf2168a --- googlemock/include/gmock/gmock-matchers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 55243b725..2532d597f 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -5548,7 +5548,7 @@ inline InnerMatcher AllArgs(const InnerMatcher& matcher) { // printable using 'PrintToString'. It is compatible with // std::optional/std::experimental::optional. // Note that to compare an optional type variable against nullopt you should -// use Eq(nullopt) and not Eq(Optional(nullopt)). The latter implies that the +// use Eq(nullopt) and not Optional(Eq(nullopt)). The latter implies that the // optional value contains an optional itself. template inline internal::OptionalMatcher Optional(