From 63df308347dd7e72573a49d2ad4c9218c97841a5 Mon Sep 17 00:00:00 2001 From: James Sedgwick Date: Fri, 4 Sep 2015 14:09:39 -0700 Subject: [PATCH] fix SharedPromise::setWith Summary: was using the renamed/nonexistent makeTryFunction Reviewed By: @elliottneilclark Differential Revision: D2416178 --- folly/futures/SharedPromise-inl.h | 2 +- folly/futures/test/SharedPromiseTest.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/folly/futures/SharedPromise-inl.h b/folly/futures/SharedPromise-inl.h index 2c09a2a0..c2f6d454 100644 --- a/folly/futures/SharedPromise-inl.h +++ b/folly/futures/SharedPromise-inl.h @@ -102,7 +102,7 @@ void SharedPromise::setValue(M&& v) { template template void SharedPromise::setWith(F&& func) { - setTry(makeTryFunction(std::forward(func))); + setTry(makeTryWith(std::forward(func))); } template diff --git a/folly/futures/test/SharedPromiseTest.cpp b/folly/futures/test/SharedPromiseTest.cpp index 495526d5..77095b15 100644 --- a/folly/futures/test/SharedPromiseTest.cpp +++ b/folly/futures/test/SharedPromiseTest.cpp @@ -100,3 +100,9 @@ TEST(SharedPromise, moveMove) { p = std::move(p2); p.setValue(std::make_shared(1)); } + +TEST(SharedPromise, setWith) { + SharedPromise p; + p.setWith([]{ return 1; }); + EXPECT_EQ(1, p.getFuture().value()); +} -- 2.34.1