From f731d644ced3530880868c2256429de7c52eae51 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 30 May 2024 14:28:20 -0700 Subject: [PATCH] Disambiguate set(0) for C++ ports This pulls in https://github.com/lf-lang/reactor-cpp/pull/57 and adds a new test case. Fixes https://github.com/lf-lang/lingua-franca/issues/2280 --- core/src/main/resources/lib/cpp/reactor-cpp | 2 +- test/Cpp/src/SetZero.lf | 27 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/Cpp/src/SetZero.lf diff --git a/core/src/main/resources/lib/cpp/reactor-cpp b/core/src/main/resources/lib/cpp/reactor-cpp index f0f62ad339..f47e5174e4 160000 --- a/core/src/main/resources/lib/cpp/reactor-cpp +++ b/core/src/main/resources/lib/cpp/reactor-cpp @@ -1 +1 @@ -Subproject commit f0f62ad339c82dc137955f7dcae617326b644622 +Subproject commit f47e5174e4cbb891a886b06395da65cc8af79640 diff --git a/test/Cpp/src/SetZero.lf b/test/Cpp/src/SetZero.lf new file mode 100644 index 0000000000..5d4c1e2ecc --- /dev/null +++ b/test/Cpp/src/SetZero.lf @@ -0,0 +1,27 @@ +target Cpp + +reactor Source { + output out: unsigned + + reaction(startup) -> out {= + out.set(0); + =} +} + +reactor Sink { + input in: unsigned + + reaction(startup, in) {= + if (!in.is_present() || *in.get() != 0) { + std::cerr << "Expected to receive 0\n"; + exit(1); + } + std::cout << "Success!\n"; + =} +} + +main reactor { + source = new Source() + sink = new Sink() + source.out -> sink.in +}