Commit 4d0dcfa7 authored by Dominik Charousset's avatar Dominik Charousset

Merge branch master into topic/neverlord/caf-net

parents 070b3ae1 9e130954
......@@ -11,6 +11,9 @@ is based on [Keep a Changelog](https://keepachangelog.com).
heap-use-after-free if the actor terminates before the action runs. The
destructor of the promise now checks for this case.
- Accessing URI fields now always returns the normalized string.
- The JSON parser no longer chokes when encountering `null` as last value before
the closing parenthesis.
- The JSON reader now automatically widens integers to doubles as necessary.
### Changed
......
......@@ -128,7 +128,7 @@ void read_json_null_or_nan(string_parser_state& ps, Consumer consumer) {
transition(done, 'n', res_type = is_nan)
}
term_state(done) {
transition(init, " \t\n")
transition(done, " \t\n")
}
fin();
// clang-format on
......
......@@ -568,6 +568,9 @@ bool json_reader::value(double& x) {
if (val.data.index() == detail::json::value::double_index) {
x = std::get<double>(val.data);
return true;
} else if (val.data.index() == detail::json::value::integer_index) {
x = std::get<int64_t>(val.data);
return true;
} else {
emplace_error(sec::runtime_error, class_name, fn, current_field_name(),
type_clash("json::real", val));
......
......@@ -49,14 +49,15 @@ struct fixture {
}
template <class T>
optional<T> get(const settings& cfg, std::string_view key) {
std::optional<T> get(const settings& cfg, std::string_view key) {
if (auto ptr = get_if<T>(&cfg, key))
return *ptr;
return none;
else
return {};
}
template <class T>
optional<T> get(std::string_view key) {
std::optional<T> get(std::string_view key) {
if (auto* xs = get_if<settings>(&x))
return get<T>(*xs, key);
else
......
......@@ -12,7 +12,6 @@
#include "caf/telemetry/metric_type.hpp"
using namespace caf;
using namespace caf::literals;
using namespace caf::telemetry;
using namespace std::literals;
......@@ -64,7 +63,7 @@ some_request_duration_seconds_bucket{x="get",le="4"} 2 42000
some_request_duration_seconds_bucket{x="get",le="+Inf"} 3 42000
some_request_duration_seconds_sum{x="get"} 14 42000
some_request_duration_seconds_count{x="get"} 3 42000
)"_sv);
)"sv);
MESSAGE("multiple runs with the same timestamp generate the same output");
auto ts = make_timestamp();
std::string res1;
......
......@@ -27,12 +27,12 @@ namespace {
// check invariants of type system
using dummy1 = typed_actor<result<void>(int, int), result<double>(double)>;
using dummy2 = dummy1::extend<reacts_to<ok_atom>>;
using dummy2 = dummy1::extend<result<void>(ok_atom)>;
static_assert(std::is_convertible<dummy2, dummy1>::value,
"handle not assignable to narrower definition");
using dummy3 = typed_actor<reacts_to<float, int>>;
using dummy3 = typed_actor<result<void>(float, int)>;
using dummy4 = typed_actor<result<double>(int)>;
using dummy5 = dummy4::extend_with<dummy3>;
......@@ -345,7 +345,7 @@ CAF_TEST(sending_typed_actors_and_down_msg) {
CAF_TEST(check_signature) {
using foo_type = typed_actor<result<ok_atom>(put_atom)>;
using foo_result_type = result<ok_atom>;
using bar_type = typed_actor<reacts_to<ok_atom>>;
using bar_type = typed_actor<result<void>(ok_atom)>;
auto foo_action = [](foo_type::pointer ptr) -> foo_type::behavior_type {
return {
[=](put_atom) -> foo_result_type {
......
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