Skip to content

Commit 2803292

Browse files
committed
Add support for concatenating string literals with/without interpolations
And test by applying throughout `reflect.h2` => we don't need a separate regression test case for the feature, `reflect.h2` exercises it well
1 parent 0e1fdd5 commit 2803292

36 files changed

+568
-468
lines changed

regression-tests/test-results/mixed-as-for-variant-20-types.cpp

+60-60
Large diffs are not rendered by default.

regression-tests/test-results/mixed-default-arguments.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ auto main() -> int;
2727

2828
#line 5 "mixed-default-arguments.cpp2"
2929
auto cxx2(cpp2::impl::in<int> x, cpp2::impl::in<std::string> y) -> void{
30-
std::cout << (cpp2::to_string(x) + " \"" + cpp2::to_string(y) + "\"\n");
30+
std::cout << "" + (cpp2::to_string(x) + " \"" + cpp2::to_string(y) + "\"\n") + "";
3131
}
3232

3333
#line 9 "mixed-default-arguments.cpp2"

regression-tests/test-results/mixed-fixed-type-aliases.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ auto test(auto const& x) -> void{
5959
for ( auto const& arg : args )
6060
std::cout << CPP2_UFCS(filename)(std::filesystem::path(arg)) << "\n";
6161

62-
std::cout << (cpp2::to_string(mytype<int>::myvalue<int>) + "\n");
62+
std::cout << "" + (cpp2::to_string(mytype<int>::myvalue<int>) + "\n") + "";
6363
}
6464

regression-tests/test-results/mixed-inspect-templates.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ struct my_type {};
5858
std::variant<int,double,std::string> var {"C++ rulez"};
5959
my_type<int,double> myt {};
6060

61-
std::cout << ("inspected vec : " + cpp2::to_string(fun(vec))) << std::endl;
62-
std::cout << ("inspected arr : " + cpp2::to_string(fun(arr))) << std::endl;
63-
std::cout << ("inspected var : " + cpp2::to_string(fun(var))) << std::endl;
64-
std::cout << ("inspected myt : " + cpp2::to_string(fun(myt))) << std::endl;
65-
66-
std::cout << ("inspected vec : " + cpp2::to_string(fun2(cpp2::move(vec)))) << std::endl;
67-
std::cout << ("inspected arr : " + cpp2::to_string(fun2(cpp2::move(arr)))) << std::endl;
68-
std::cout << ("inspected var : " + cpp2::to_string(fun2(cpp2::move(var)))) << std::endl;
69-
std::cout << ("inspected myt : " + cpp2::to_string(fun2(cpp2::move(myt)))) << std::endl;
61+
std::cout << "" + ("inspected vec : " + cpp2::to_string(fun(vec))) + "" << std::endl;
62+
std::cout << "" + ("inspected arr : " + cpp2::to_string(fun(arr))) + "" << std::endl;
63+
std::cout << "" + ("inspected var : " + cpp2::to_string(fun(var))) + "" << std::endl;
64+
std::cout << "" + ("inspected myt : " + cpp2::to_string(fun(myt))) + "" << std::endl;
65+
66+
std::cout << "" + ("inspected vec : " + cpp2::to_string(fun2(cpp2::move(vec)))) + "" << std::endl;
67+
std::cout << "" + ("inspected arr : " + cpp2::to_string(fun2(cpp2::move(arr)))) + "" << std::endl;
68+
std::cout << "" + ("inspected var : " + cpp2::to_string(fun2(cpp2::move(var)))) + "" << std::endl;
69+
std::cout << "" + ("inspected myt : " + cpp2::to_string(fun2(cpp2::move(myt)))) + "" << std::endl;
7070
}
7171

regression-tests/test-results/mixed-string-interpolation.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,47 @@ struct custom_struct_with_no_stringize_customization { } custom;
2929
[[nodiscard]] auto main() -> int{
3030
auto a {2};
3131
std::optional<int> b {};
32-
std::cout << ("a = " + cpp2::to_string(a) + ", b = " + cpp2::to_string(b) + "\n");
32+
std::cout << "" + ("a = " + cpp2::to_string(a) + ", b = " + cpp2::to_string(b) + "\n") + "";
3333

3434
b = 42;
35-
std::cout << ("a^2 + b = " + cpp2::to_string(a * a + CPP2_UFCS(value)(cpp2::move(b))) + "\n");
35+
std::cout << "" + ("a^2 + b = " + cpp2::to_string(a * a + CPP2_UFCS(value)(cpp2::move(b))) + "\n") + "";
3636

3737
std::string_view sv {"my string_view"};
38-
std::cout << ("sv = " + cpp2::to_string(cpp2::move(sv)) + "\n");
38+
std::cout << "" + ("sv = " + cpp2::to_string(cpp2::move(sv)) + "\n") + "";
3939

4040
std::optional<std::string_view> osv {};
41-
std::cout << ("osv = " + cpp2::to_string(osv) + "\n");
41+
std::cout << "" + ("osv = " + cpp2::to_string(osv) + "\n") + "";
4242
osv = "string literal bound to optional string_view";
43-
std::cout << ("osv = " + cpp2::to_string(cpp2::move(osv)) + "\n");
43+
std::cout << "" + ("osv = " + cpp2::to_string(cpp2::move(osv)) + "\n") + "";
4444

4545
std::variant<std::monostate,std::string,double> var {};
46-
std::cout << ("var = " + cpp2::to_string(var) + "\n");
46+
std::cout << "" + ("var = " + cpp2::to_string(var) + "\n") + "";
4747
var = "abracadabra";
48-
std::cout << ("var = " + cpp2::to_string(var) + "\n");
48+
std::cout << "" + ("var = " + cpp2::to_string(var) + "\n") + "";
4949
var = 2.71828;
50-
std::cout << ("var = " + cpp2::to_string(cpp2::move(var)) + "\n");
50+
std::cout << "" + ("var = " + cpp2::to_string(cpp2::move(var)) + "\n") + "";
5151

5252
std::pair<int,double> mypair {12, 3.4};
53-
std::cout << ("mypair = " + cpp2::to_string(cpp2::move(mypair)) + "\n");
53+
std::cout << "" + ("mypair = " + cpp2::to_string(cpp2::move(mypair)) + "\n") + "";
5454

5555
std::tuple<int> tup1 {12};
5656
std::tuple<int,double> tup2 {12, 3.4};
5757
std::tuple<int,double,std::string> tup3 {12, 3.4, "456"};
58-
std::cout << ("tup1 = " + cpp2::to_string(cpp2::move(tup1)) + "\n");
59-
std::cout << ("tup2 = " + cpp2::to_string(cpp2::move(tup2)) + "\n");
60-
std::cout << ("tup3 = " + cpp2::to_string(cpp2::move(tup3)) + "\n");
58+
std::cout << "" + ("tup1 = " + cpp2::to_string(cpp2::move(tup1)) + "\n") + "";
59+
std::cout << "" + ("tup2 = " + cpp2::to_string(cpp2::move(tup2)) + "\n") + "";
60+
std::cout << "" + ("tup3 = " + cpp2::to_string(cpp2::move(tup3)) + "\n") + "";
6161

6262
std::pair<std::string_view,std::optional<std::string>> p {"first", std::nullopt};
63-
std::cout << ("p = " + cpp2::to_string(cpp2::move(p)) + "\n");
63+
std::cout << "" + ("p = " + cpp2::to_string(cpp2::move(p)) + "\n") + "";
6464

6565
std::tuple<double,std::optional<std::pair<std::string_view,int>>,std::optional<std::tuple<int,int,int>>> t {3.14, std::nullopt, std::nullopt};
66-
std::cout << ("t = " + cpp2::to_string(cpp2::move(t)) + "\n");
66+
std::cout << "" + ("t = " + cpp2::to_string(cpp2::move(t)) + "\n") + "";
6767

6868
std::variant<int,std::string,std::pair<int,double>> vv {};
69-
std::cout << ("vv = " + cpp2::to_string(vv) + "\n");
69+
std::cout << "" + ("vv = " + cpp2::to_string(vv) + "\n") + "";
7070
vv = std::make_pair(1, 2.3);
71-
std::cout << ("vv = " + cpp2::to_string(cpp2::move(vv)) + "\n");
71+
std::cout << "" + ("vv = " + cpp2::to_string(cpp2::move(vv)) + "\n") + "";
7272

73-
std::cout << ("custom = " + cpp2::to_string(custom) + "\n");
73+
std::cout << "" + ("custom = " + cpp2::to_string(custom) + "\n") + "";
7474
}
7575

regression-tests/test-results/mixed-test-parens.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ constexpr int a = 1;
3232

3333
std::vector<int> v {1, 2, 3};
3434
std::cout << (1 + 2) * (3 + CPP2_ASSERT_IN_BOUNDS_LITERAL(cpp2::move(v), 0));
35-
std::cout << ("\n13*14 is " + cpp2::to_string(13 * 14) + "\n");
35+
std::cout << "" + ("\n13*14 is " + cpp2::to_string(13 * 14) + "\n") + "";
3636
f<(cpp2::impl::cmp_greater(1,2))>(3, 4);
3737
f<a + a>(5, 6);
3838
}

regression-tests/test-results/pure2-bugfix-for-template-argument.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ auto main() -> int;
1919
#line 1 "pure2-bugfix-for-template-argument.cpp2"
2020
auto main() -> int {
2121
#line 2 "pure2-bugfix-for-template-argument.cpp2"
22-
std::cout << (cpp2::to_string(std::is_void_v<cpp2::i32*> && std::is_void_v<cpp2::i32 const>) + "\n"); }
22+
std::cout << "" + (cpp2::to_string(std::is_void_v<cpp2::i32*> && std::is_void_v<cpp2::i32 const>) + "\n") + ""; }
2323

regression-tests/test-results/pure2-contracts.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ auto main() -> int{
4343
if (cpp2::type_safety.is_active() && !(test_condition_evaluation(2)) ) { cpp2::type_safety.report_violation(CPP2_CONTRACT_MSG("type")); }// evaluated: prints "2"
4444
CPP2_UFCS(set_handler)(cpp2::type_safety);
4545
// Type does not have a handler
46-
if (cpp2::type_safety.is_active() && !(test_condition_evaluation(3)) ) { cpp2::type_safety.report_violation(CPP2_CONTRACT_MSG(("1 == " + cpp2::to_string(1)))); }// not evaluated
46+
if (cpp2::type_safety.is_active() && !(test_condition_evaluation(3)) ) { cpp2::type_safety.report_violation(CPP2_CONTRACT_MSG("" + ("1 == " + cpp2::to_string(1)) + "")); }// not evaluated
4747

4848
// Bounds has a handler, and audit is true
4949
if (audit && cpp2::bounds_safety.is_active() && !(test_condition_evaluation(4)) ) { cpp2::bounds_safety.report_violation(CPP2_CONTRACT_MSG("type")); }// evaluated: prints "4"

regression-tests/test-results/pure2-enum.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ auto main() -> int{
255255
// if x == 9 { } // error, can't compare skat_game and integer
256256
// if x == rgb::red { } // error, can't compare skat_game and rgb color
257257

258-
std::cout << ("x.to_string() is " + cpp2::to_string(CPP2_UFCS(to_string)(x)) + "\n");
259-
std::cout << ("x2.to_string() is " + cpp2::to_string(CPP2_UFCS(to_string)(cpp2::move(x2))) + "\n");
258+
std::cout << "" + ("x.to_string() is " + cpp2::to_string(CPP2_UFCS(to_string)(x)) + "\n") + "";
259+
std::cout << "" + ("x2.to_string() is " + cpp2::to_string(CPP2_UFCS(to_string)(cpp2::move(x2))) + "\n") + "";
260260

261261
std::cout << "with if else: ";
262262
if (x == skat_game::diamonds) { // ok, can compare two skat_games
@@ -288,17 +288,17 @@ auto main() -> int{
288288

289289
x = skat_game::diamonds; // ok, can assign one skat_game from another
290290

291-
std::cout << ("file_attributes::cached.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached)) + "\n");
292-
std::cout << ("file_attributes::current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::current)) + "\n");
293-
std::cout << ("file_attributes::obsolete.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::obsolete)) + "\n");
294-
std::cout << ("file_attributes::cached_and_current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached_and_current)) + "\n");
291+
std::cout << "" + ("file_attributes::cached.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached)) + "\n") + "";
292+
std::cout << "" + ("file_attributes::current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::current)) + "\n") + "";
293+
std::cout << "" + ("file_attributes::obsolete.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::obsolete)) + "\n") + "";
294+
std::cout << "" + ("file_attributes::cached_and_current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached_and_current)) + "\n") + "";
295295

296296
file_attributes f {file_attributes::cached_and_current};
297297
f &= file_attributes::cached | file_attributes::obsolete;
298-
std::cout << ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n");
298+
std::cout << "" + ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n") + "";
299299

300300
auto f2 {file_attributes::cached};
301-
std::cout << ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n");
301+
std::cout << "" + ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n") + "";
302302

303303
std::cout << "f is " << CPP2_UFCS(to_string)(f) << "\n";
304304
std::cout << "f2 is " << CPP2_UFCS(to_string)(f2) << "\n";
@@ -308,11 +308,11 @@ auto main() -> int{
308308
CPP2_UFCS(set)(f2, file_attributes::cached);
309309
std::cout << "f2 is " << CPP2_UFCS(to_string)(f2) << "\n";
310310

311-
std::cout << ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n");
312-
std::cout << ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n");
311+
std::cout << "" + ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n") + "";
312+
std::cout << "" + ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n") + "";
313313

314-
std::cout << ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n");
315-
std::cout << ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n\n");
314+
std::cout << "" + ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n") + "";
315+
std::cout << "" + ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n\n") + "";
316316

317317
CPP2_UFCS(clear)(f, f2);
318318
CPP2_UFCS(set)(f, file_attributes::current | f2);
@@ -321,12 +321,12 @@ auto main() -> int{
321321

322322
std::cout << "f is " << CPP2_UFCS(to_string)(f) << "\n";
323323
std::cout << "f2 is " << CPP2_UFCS(to_string)(f2) << "\n";
324-
std::cout << ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n");
325-
std::cout << ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n");
326-
std::cout << ("f == f2 is " + cpp2::to_string(f == f2 ) + "\n");
327-
std::cout << ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n");
328-
std::cout << ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n");
329-
std::cout << ("(f & f2) == f2 is " + cpp2::to_string((f & f2) == f2) + "\n");
324+
std::cout << "" + ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n") + "";
325+
std::cout << "" + ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n") + "";
326+
std::cout << "" + ("f == f2 is " + cpp2::to_string(f == f2 ) + "\n") + "";
327+
std::cout << "" + ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n") + "";
328+
std::cout << "" + ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n") + "";
329+
std::cout << "" + ("(f & f2) == f2 is " + cpp2::to_string((f & f2) == f2) + "\n") + "";
330330

331331
std::cout << "inspecting f: " << [&] () -> std::string { auto&& _expr = cpp2::move(f);
332332
if (cpp2::impl::is(_expr, (file_attributes::current))) { if constexpr( requires{"exactly 'current'";} ) if constexpr( std::is_convertible_v<CPP2_TYPEOF(("exactly 'current'")),std::string> ) return "exactly 'current'"; else return std::string{}; else return std::string{}; }

regression-tests/test-results/pure2-interpolation.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ auto const& x{0};
4646

4747
#line 11 "pure2-interpolation.cpp2"
4848
{
49-
std::cout << ("g" + cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") << "\n";
50-
std::cout << (cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") << "\n";
51-
std::cout << (cpp2::to_string(x) + "g" + cpp2::to_string(x)) << "\n";
52-
std::cout << (cpp2::to_string(x) + cpp2::to_string(x)) << "\n";
53-
std::cout << ("\"" + cpp2::to_string(x) + "\"") << "\n";
54-
std::cout << ("\"" + cpp2::to_string(x)) << "\n";
49+
std::cout << "" + ("g" + cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") + "" << "\n";
50+
std::cout << "" + (cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") + "" << "\n";
51+
std::cout << "" + (cpp2::to_string(x) + "g" + cpp2::to_string(x)) + "" << "\n";
52+
std::cout << "" + (cpp2::to_string(x) + cpp2::to_string(x)) + "" << "\n";
53+
std::cout << "" + ("\"" + cpp2::to_string(x) + "\"") + "" << "\n";
54+
std::cout << "" + ("\"" + cpp2::to_string(x)) + "" << "\n";
5555
std::cout << "\"" << "\n";
5656
std::cout << "" << "\n";
5757
std::cout << "pl(ug$h" << "\n";
58-
std::cout << (cpp2::to_string(x) + "pl(ug$h") << "\n";
58+
std::cout << "" + (cpp2::to_string(x) + "pl(ug$h") + "" << "\n";
5959

6060
}
6161
}
@@ -66,13 +66,13 @@ auto const& x{item()};
6666
{
6767
std::cout << std::left << std::setw(20) << CPP2_UFCS(name)(x) << " color " << std::left << std::setw(10) << CPP2_UFCS(color)(x) << " price " << std::setw(10) << std::setprecision(3) << CPP2_UFCS(price)(x) << " in stock = " << std::boolalpha << (cpp2::impl::cmp_greater(CPP2_UFCS(count)(x),0)) << "\n";
6868

69-
std::cout << (cpp2::to_string(CPP2_UFCS(name)(x), "{:20}") + " color " + cpp2::to_string(CPP2_UFCS(color)(x), "{:10}") + " price " + cpp2::to_string(CPP2_UFCS(price)(x), "{: <10.2f}") + " in stock = " + cpp2::to_string(cpp2::impl::cmp_greater(CPP2_UFCS(count)(x),0)) + "\n");
69+
std::cout << "" + (cpp2::to_string(CPP2_UFCS(name)(x), "{:20}") + " color " + cpp2::to_string(CPP2_UFCS(color)(x), "{:10}") + " price " + cpp2::to_string(CPP2_UFCS(price)(x), "{: <10.2f}") + " in stock = " + cpp2::to_string(cpp2::impl::cmp_greater(CPP2_UFCS(count)(x),0)) + "\n") + "";
7070
}
7171
}
7272

7373
#line 31 "pure2-interpolation.cpp2"
7474
std::complex ri {1.2, 3.4};
75-
std::cout << ("complex: " + cpp2::to_string(cpp2::move(ri)) + "\n");// works on GCC 11.2+ and Clang 13+
75+
std::cout << "" + ("complex: " + cpp2::to_string(cpp2::move(ri)) + "\n") + "";// works on GCC 11.2+ and Clang 13+
7676
// prints "customize me" on GCC 11.1 and Clang 12
7777
}
7878

regression-tests/test-results/pure2-is-with-free-functions-predicate.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ auto fun(auto const& v) -> void;
3232
auto fun(auto const& v) -> void{
3333
#line 2 "pure2-is-with-free-functions-predicate.cpp2"
3434
if (cpp2::impl::is(v, (pred_i))) {
35-
std::cout << (cpp2::to_string(v) + " is integer bigger than 3") << std::endl;
35+
std::cout << "" + (cpp2::to_string(v) + " is integer bigger than 3") + "" << std::endl;
3636
}
3737

3838
if (cpp2::impl::is(v, (pred_d))) {
39-
std::cout << (cpp2::to_string(v) + " is double bigger than 3") << std::endl;
39+
std::cout << "" + (cpp2::to_string(v) + " is double bigger than 3") + "" << std::endl;
4040
}
4141

4242
if (cpp2::impl::is(v, (pred_))) {
43-
std::cout << (cpp2::to_string(v) + " is bigger than 3") << std::endl;
43+
std::cout << "" + (cpp2::to_string(v) + " is bigger than 3") + "" << std::endl;
4444
}
4545
}
4646

regression-tests/test-results/pure2-is-with-unnamed-predicates.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ auto fun(auto const& v) -> void;
2323
auto fun(auto const& v) -> void{
2424
#line 2 "pure2-is-with-unnamed-predicates.cpp2"
2525
if (cpp2::impl::is(v, ([](cpp2::impl::in<int> x) mutable -> auto { return cpp2::impl::cmp_greater(x,3); }))) {
26-
std::cout << (cpp2::to_string(v) + " is integer bigger than 3") << std::endl;
26+
std::cout << "" + (cpp2::to_string(v) + " is integer bigger than 3") + "" << std::endl;
2727
}
2828

2929
if (cpp2::impl::is(v, ([](cpp2::impl::in<double> x) mutable -> auto { return cpp2::impl::cmp_greater(x,3); }))) {
30-
std::cout << (cpp2::to_string(v) + " is double bigger than 3") << std::endl;
30+
std::cout << "" + (cpp2::to_string(v) + " is double bigger than 3") + "" << std::endl;
3131
}
3232

3333
if (cpp2::impl::is(v, ([](auto const& x) mutable -> auto { return cpp2::impl::cmp_greater(x,3); }))) {
34-
std::cout << (cpp2::to_string(v) + " is bigger than 3") << std::endl;
34+
std::cout << "" + (cpp2::to_string(v) + " is bigger than 3") + "" << std::endl;
3535
}
3636
}
3737

regression-tests/test-results/pure2-last-use.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ auto const& x{cpp2_new<int>(0)};
12981298
#line 790 "pure2-last-use.cpp2"
12991299
auto issue_962(cpp2::impl::in<::std::string> s) -> void{
13001300
using ::std::string;
1301-
std::cout << ("A: " + cpp2::to_string(s)) << std::endl;
1301+
std::cout << "" + ("A: " + cpp2::to_string(s)) + "" << std::endl;
13021302
}
13031303

13041304
#line 795 "pure2-last-use.cpp2"

regression-tests/test-results/pure2-main-args.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ auto main(int const argc_, char** argv_) -> int{
2626
#line 6 "pure2-main-args.cpp2"
2727
auto exe {CPP2_UFCS(string)(CPP2_UFCS(filename)(std::filesystem::path(CPP2_ASSERT_IN_BOUNDS_LITERAL(args.argv, 0))))};
2828
std::cout
29-
<< ("args.argc is " + cpp2::to_string(args.argc) + "\n")
30-
<< ("args.argv[0] is " + cpp2::to_string(cpp2::move(exe)) + "\n");
29+
<< "" + ("args.argc is " + cpp2::to_string(args.argc) + "\n") + ""
30+
<< "" + ("args.argv[0] is " + cpp2::to_string(cpp2::move(exe)) + "\n") + "";
3131

3232
}
3333

regression-tests/test-results/pure2-print.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias{ 42 };
121121
#line 36 "pure2-print.cpp2"
122122
{
123123
if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(empty)(m) == false || false) ) { cpp2::cpp2_default.report_violation(CPP2_CONTRACT_MSG("message")); }
124-
if (testing_enabled && cpp2::bounds_safety.is_active() && !([_0 = 0, _1 = CPP2_UFCS(ssize)(m), _2 = 100]{ return cpp2::impl::cmp_less(_0,_1) && cpp2::impl::cmp_less(_1,_2); }() && true != false) ) { cpp2::bounds_safety.report_violation(CPP2_CONTRACT_MSG(("size is " + cpp2::to_string(CPP2_UFCS(ssize)(m))))); }
124+
if (testing_enabled && cpp2::bounds_safety.is_active() && !([_0 = 0, _1 = CPP2_UFCS(ssize)(m), _2 = 100]{ return cpp2::impl::cmp_less(_0,_1) && cpp2::impl::cmp_less(_1,_2); }() && true != false) ) { cpp2::bounds_safety.report_violation(CPP2_CONTRACT_MSG("" + ("size is " + cpp2::to_string(CPP2_UFCS(ssize)(m))) + "")); }
125125
#line 37 "pure2-print.cpp2"
126126
auto a {[]() mutable -> void{}};
127127
auto b {[]() mutable -> void{}};

regression-tests/test-results/pure2-print.cpp2.output

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ outer:/* @print */ type =
3333
inout m: std::map<const int, std::string>,
3434
) -> move std::string
3535
pre( m.empty() == false || false, "message" )
36-
pre<bounds_safety,testing_enabled>( 0 < m.ssize() < 100 && true != false, ("size is " + cpp2::to_string(m.ssize())) ) =
36+
pre<bounds_safety,testing_enabled>( 0 < m.ssize() < 100 && true != false, "" + ("size is " + cpp2::to_string(m.ssize())) + "" ) =
3737
{
3838
a: _ = :() =
3939
{

0 commit comments

Comments
 (0)