Skip to content

Commit

Permalink
Add support for concatenating string literals with/without interpolat…
Browse files Browse the repository at this point in the history
…ions

And test by applying throughout `reflect.h2` => we don't need a separate regression test case for the feature, `reflect.h2` exercises it well
  • Loading branch information
hsutter committed Jul 10, 2024
1 parent 0e1fdd5 commit 2803292
Show file tree
Hide file tree
Showing 36 changed files with 568 additions and 468 deletions.
120 changes: 60 additions & 60 deletions regression-tests/test-results/mixed-as-for-variant-20-types.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion regression-tests/test-results/mixed-default-arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ auto main() -> int;

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

#line 9 "mixed-default-arguments.cpp2"
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/test-results/mixed-fixed-type-aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ auto test(auto const& x) -> void{
for ( auto const& arg : args )
std::cout << CPP2_UFCS(filename)(std::filesystem::path(arg)) << "\n";

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

18 changes: 9 additions & 9 deletions regression-tests/test-results/mixed-inspect-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ struct my_type {};
std::variant<int,double,std::string> var {"C++ rulez"};
my_type<int,double> myt {};

std::cout << ("inspected vec : " + cpp2::to_string(fun(vec))) << std::endl;
std::cout << ("inspected arr : " + cpp2::to_string(fun(arr))) << std::endl;
std::cout << ("inspected var : " + cpp2::to_string(fun(var))) << std::endl;
std::cout << ("inspected myt : " + cpp2::to_string(fun(myt))) << std::endl;

std::cout << ("inspected vec : " + cpp2::to_string(fun2(cpp2::move(vec)))) << std::endl;
std::cout << ("inspected arr : " + cpp2::to_string(fun2(cpp2::move(arr)))) << std::endl;
std::cout << ("inspected var : " + cpp2::to_string(fun2(cpp2::move(var)))) << std::endl;
std::cout << ("inspected myt : " + cpp2::to_string(fun2(cpp2::move(myt)))) << std::endl;
std::cout << "" + ("inspected vec : " + cpp2::to_string(fun(vec))) + "" << std::endl;
std::cout << "" + ("inspected arr : " + cpp2::to_string(fun(arr))) + "" << std::endl;
std::cout << "" + ("inspected var : " + cpp2::to_string(fun(var))) + "" << std::endl;
std::cout << "" + ("inspected myt : " + cpp2::to_string(fun(myt))) + "" << std::endl;

std::cout << "" + ("inspected vec : " + cpp2::to_string(fun2(cpp2::move(vec)))) + "" << std::endl;
std::cout << "" + ("inspected arr : " + cpp2::to_string(fun2(cpp2::move(arr)))) + "" << std::endl;
std::cout << "" + ("inspected var : " + cpp2::to_string(fun2(cpp2::move(var)))) + "" << std::endl;
std::cout << "" + ("inspected myt : " + cpp2::to_string(fun2(cpp2::move(myt)))) + "" << std::endl;
}

34 changes: 17 additions & 17 deletions regression-tests/test-results/mixed-string-interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,47 @@ struct custom_struct_with_no_stringize_customization { } custom;
[[nodiscard]] auto main() -> int{
auto a {2};
std::optional<int> b {};
std::cout << ("a = " + cpp2::to_string(a) + ", b = " + cpp2::to_string(b) + "\n");
std::cout << "" + ("a = " + cpp2::to_string(a) + ", b = " + cpp2::to_string(b) + "\n") + "";

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

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

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

std::variant<std::monostate,std::string,double> var {};
std::cout << ("var = " + cpp2::to_string(var) + "\n");
std::cout << "" + ("var = " + cpp2::to_string(var) + "\n") + "";
var = "abracadabra";
std::cout << ("var = " + cpp2::to_string(var) + "\n");
std::cout << "" + ("var = " + cpp2::to_string(var) + "\n") + "";
var = 2.71828;
std::cout << ("var = " + cpp2::to_string(cpp2::move(var)) + "\n");
std::cout << "" + ("var = " + cpp2::to_string(cpp2::move(var)) + "\n") + "";

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

std::tuple<int> tup1 {12};
std::tuple<int,double> tup2 {12, 3.4};
std::tuple<int,double,std::string> tup3 {12, 3.4, "456"};
std::cout << ("tup1 = " + cpp2::to_string(cpp2::move(tup1)) + "\n");
std::cout << ("tup2 = " + cpp2::to_string(cpp2::move(tup2)) + "\n");
std::cout << ("tup3 = " + cpp2::to_string(cpp2::move(tup3)) + "\n");
std::cout << "" + ("tup1 = " + cpp2::to_string(cpp2::move(tup1)) + "\n") + "";
std::cout << "" + ("tup2 = " + cpp2::to_string(cpp2::move(tup2)) + "\n") + "";
std::cout << "" + ("tup3 = " + cpp2::to_string(cpp2::move(tup3)) + "\n") + "";

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

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};
std::cout << ("t = " + cpp2::to_string(cpp2::move(t)) + "\n");
std::cout << "" + ("t = " + cpp2::to_string(cpp2::move(t)) + "\n") + "";

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

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

2 changes: 1 addition & 1 deletion regression-tests/test-results/mixed-test-parens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ constexpr int a = 1;

std::vector<int> v {1, 2, 3};
std::cout << (1 + 2) * (3 + CPP2_ASSERT_IN_BOUNDS_LITERAL(cpp2::move(v), 0));
std::cout << ("\n13*14 is " + cpp2::to_string(13 * 14) + "\n");
std::cout << "" + ("\n13*14 is " + cpp2::to_string(13 * 14) + "\n") + "";
f<(cpp2::impl::cmp_greater(1,2))>(3, 4);
f<a + a>(5, 6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ auto main() -> int;
#line 1 "pure2-bugfix-for-template-argument.cpp2"
auto main() -> int {
#line 2 "pure2-bugfix-for-template-argument.cpp2"
std::cout << (cpp2::to_string(std::is_void_v<cpp2::i32*> && std::is_void_v<cpp2::i32 const>) + "\n"); }
std::cout << "" + (cpp2::to_string(std::is_void_v<cpp2::i32*> && std::is_void_v<cpp2::i32 const>) + "\n") + ""; }

2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-contracts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ auto main() -> int{
if (cpp2::type_safety.is_active() && !(test_condition_evaluation(2)) ) { cpp2::type_safety.report_violation(CPP2_CONTRACT_MSG("type")); }// evaluated: prints "2"
CPP2_UFCS(set_handler)(cpp2::type_safety);
// Type does not have a handler
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
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

// Bounds has a handler, and audit is true
if (audit && cpp2::bounds_safety.is_active() && !(test_condition_evaluation(4)) ) { cpp2::bounds_safety.report_violation(CPP2_CONTRACT_MSG("type")); }// evaluated: prints "4"
Expand Down
36 changes: 18 additions & 18 deletions regression-tests/test-results/pure2-enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ auto main() -> int{
// if x == 9 { } // error, can't compare skat_game and integer
// if x == rgb::red { } // error, can't compare skat_game and rgb color

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

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

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

std::cout << ("file_attributes::cached.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached)) + "\n");
std::cout << ("file_attributes::current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::current)) + "\n");
std::cout << ("file_attributes::obsolete.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::obsolete)) + "\n");
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");
std::cout << "" + ("file_attributes::cached.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::cached)) + "\n") + "";
std::cout << "" + ("file_attributes::current.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::current)) + "\n") + "";
std::cout << "" + ("file_attributes::obsolete.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(file_attributes::obsolete)) + "\n") + "";
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") + "";

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

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

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

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

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

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

std::cout << "f is " << CPP2_UFCS(to_string)(f) << "\n";
std::cout << "f2 is " << CPP2_UFCS(to_string)(f2) << "\n";
std::cout << ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n");
std::cout << ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n");
std::cout << ("f == f2 is " + cpp2::to_string(f == f2 ) + "\n");
std::cout << ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n");
std::cout << ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n");
std::cout << ("(f & f2) == f2 is " + cpp2::to_string((f & f2) == f2) + "\n");
std::cout << "" + ("f. get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f)) + "\n") + "";
std::cout << "" + ("f2.get_raw_value() is " + cpp2::to_string(CPP2_UFCS(get_raw_value)(f2)) + "\n") + "";
std::cout << "" + ("f == f2 is " + cpp2::to_string(f == f2 ) + "\n") + "";
std::cout << "" + ("f is (f2) is " + cpp2::to_string(cpp2::impl::is(f, (f2))) + "\n") + "";
std::cout << "" + ("f2 is (f ) is " + cpp2::to_string(cpp2::impl::is(f2, (f))) + "\n") + "";
std::cout << "" + ("(f & f2) == f2 is " + cpp2::to_string((f & f2) == f2) + "\n") + "";

std::cout << "inspecting f: " << [&] () -> std::string { auto&& _expr = cpp2::move(f);
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{}; }
Expand Down
18 changes: 9 additions & 9 deletions regression-tests/test-results/pure2-interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ auto const& x{0};

#line 11 "pure2-interpolation.cpp2"
{
std::cout << ("g" + cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") << "\n";
std::cout << (cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") << "\n";
std::cout << (cpp2::to_string(x) + "g" + cpp2::to_string(x)) << "\n";
std::cout << (cpp2::to_string(x) + cpp2::to_string(x)) << "\n";
std::cout << ("\"" + cpp2::to_string(x) + "\"") << "\n";
std::cout << ("\"" + cpp2::to_string(x)) << "\n";
std::cout << "" + ("g" + cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") + "" << "\n";
std::cout << "" + (cpp2::to_string(x) + "g" + cpp2::to_string(x) + "g") + "" << "\n";
std::cout << "" + (cpp2::to_string(x) + "g" + cpp2::to_string(x)) + "" << "\n";
std::cout << "" + (cpp2::to_string(x) + cpp2::to_string(x)) + "" << "\n";
std::cout << "" + ("\"" + cpp2::to_string(x) + "\"") + "" << "\n";
std::cout << "" + ("\"" + cpp2::to_string(x)) + "" << "\n";
std::cout << "\"" << "\n";
std::cout << "" << "\n";
std::cout << "pl(ug$h" << "\n";
std::cout << (cpp2::to_string(x) + "pl(ug$h") << "\n";
std::cout << "" + (cpp2::to_string(x) + "pl(ug$h") + "" << "\n";

}
}
Expand All @@ -66,13 +66,13 @@ auto const& x{item()};
{
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";

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");
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") + "";
}
}

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

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

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

if (cpp2::impl::is(v, (pred_))) {
std::cout << (cpp2::to_string(v) + " is bigger than 3") << std::endl;
std::cout << "" + (cpp2::to_string(v) + " is bigger than 3") + "" << std::endl;
}
}

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-last-use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ auto const& x{cpp2_new<int>(0)};
#line 790 "pure2-last-use.cpp2"
auto issue_962(cpp2::impl::in<::std::string> s) -> void{
using ::std::string;
std::cout << ("A: " + cpp2::to_string(s)) << std::endl;
std::cout << "" + ("A: " + cpp2::to_string(s)) + "" << std::endl;
}

#line 795 "pure2-last-use.cpp2"
Expand Down
4 changes: 2 additions & 2 deletions regression-tests/test-results/pure2-main-args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ auto main(int const argc_, char** argv_) -> int{
#line 6 "pure2-main-args.cpp2"
auto exe {CPP2_UFCS(string)(CPP2_UFCS(filename)(std::filesystem::path(CPP2_ASSERT_IN_BOUNDS_LITERAL(args.argv, 0))))};
std::cout
<< ("args.argc is " + cpp2::to_string(args.argc) + "\n")
<< ("args.argv[0] is " + cpp2::to_string(cpp2::move(exe)) + "\n");
<< "" + ("args.argc is " + cpp2::to_string(args.argc) + "\n") + ""
<< "" + ("args.argv[0] is " + cpp2::to_string(cpp2::move(exe)) + "\n") + "";

}

2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ requires (true) inline CPP2_CONSTEXPR T outer::object_alias{ 42 };
#line 36 "pure2-print.cpp2"
{
if (cpp2::cpp2_default.is_active() && !(CPP2_UFCS(empty)(m) == false || false) ) { cpp2::cpp2_default.report_violation(CPP2_CONTRACT_MSG("message")); }
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))))); }
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))) + "")); }
#line 37 "pure2-print.cpp2"
auto a {[]() mutable -> void{}};
auto b {[]() mutable -> void{}};
Expand Down
2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-print.cpp2.output
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ outer:/* @print */ type =
inout m: std::map<const int, std::string>,
) -> move std::string
pre( m.empty() == false || false, "message" )
pre<bounds_safety,testing_enabled>( 0 < m.ssize() < 100 && true != false, ("size is " + cpp2::to_string(m.ssize())) ) =
pre<bounds_safety,testing_enabled>( 0 < m.ssize() < 100 && true != false, "" + ("size is " + cpp2::to_string(m.ssize())) + "" ) =
{
a: _ = :() =
{
Expand Down
Loading

0 comments on commit 2803292

Please sign in to comment.