Skip to content

Commit

Permalink
refactor: finish rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Sep 22, 2023
1 parent a0f7a74 commit c24da88
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sizeof(x) is 25
(not a name)
xyz
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template<typename T> [[nodiscard]] auto f(cpp2::in<t> o, auto const& x) -> cpp2:
template<typename T, typename U> [[nodiscard]] auto f(cpp2::in<t> o, auto const& x, auto const& y) -> cpp2::i32;
extern t m;
extern t const n;
template<typename T, typename U> auto static constexpr a = n;
template<typename T, typename U> auto inline constexpr a = n;
extern cpp2::i32 auto_21_1;
extern cpp2::i32 auto_22_1;
extern cpp2::i32 auto_23_1;
Expand Down
1 change: 1 addition & 0 deletions regression-tests/test-results/pure2-enum.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#define CPP2_USE_MODULES Yes

//=== Cpp2 type declarations ====================================================

Expand Down
20 changes: 10 additions & 10 deletions regression-tests/test-results/pure2-print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ requires (true)
if (cpp2::cmp_less(*cpp2::assert_not_null(p),0)) {
ret = -*cpp2::assert_not_null(std::move(p));
}
ret += strlen(s) - 10 + CPP2_UFCS_0(strlen, std::move(s)) * (16 / (3 & 2)) % 3;
ret += strlen(s) - 10 + CPP2_UFCS(strlen)(std::move(s)) * (16 / (3 & 2)) % 3;

std::map<int const,std::string> m {};
cpp2::assert_in_bounds(m, 0) = cpp2::as_<std::string>("har");
ret -= CPP2_UFCS_0(length, h("x", m));
ret -= CPP2_UFCS(length)(h("x", m));
static_cast<void>(std::move(m));

return ret;
Expand All @@ -117,24 +117,24 @@ requires (true)

#line 32 "pure2-print.cpp2"
{
cpp2::Default.expects(CPP2_UFCS_0(empty, m) == false || false, "");
cpp2::Bounds.expects([_0 = 0, _1 = CPP2_UFCS_0(ssize, m), _2 = 100]{ return cpp2::cmp_less(_0,_1) && cpp2::cmp_less(_1,_2); }() && true != false, "");
cpp2::Default.expects(CPP2_UFCS(empty)(m) == false || false, "");
cpp2::Bounds.expects([_0 = 0, _1 = CPP2_UFCS(ssize)(m), _2 = 100]{ return cpp2::cmp_less(_0,_1) && cpp2::cmp_less(_1,_2); }() && true != false, "");
#line 33 "pure2-print.cpp2"
auto a {[]() -> void{}};
auto b {[]() -> void{}};
auto c {[]() -> void{}};

for( ; CPP2_UFCS_0(empty, s); a() ) {break; }
for( ; CPP2_UFCS(empty)(s); a() ) {break; }

do {} while ( CPP2_UFCS_0(empty, s) && [&]{ b() ; return true; }() );
do {} while ( CPP2_UFCS(empty)(s) && [&]{ b() ; return true; }() );

for ( [[maybe_unused]] auto const& param1 : m ) {
#line 41 "pure2-print.cpp2"
{ do {goto CONTINUE_41_13; } while (false); c(); } CPP2_CONTINUE_BREAK(41_13) }

#line 43 "pure2-print.cpp2"
if (cpp2::is(!(CPP2_UFCS_0(empty, s)), (true))) {std::move(a)(); }
else {if (!(CPP2_UFCS_0(empty, m))) {std::move(b)(); }
if (cpp2::is(!(CPP2_UFCS(empty)(s)), (true))) {std::move(a)(); }
else {if (!(CPP2_UFCS(empty)(m))) {std::move(b)(); }
else {std::move(c)(); }}

cpp2::Default.expects(true, "");
Expand Down Expand Up @@ -169,9 +169,9 @@ requires (true)

#line 75 "pure2-print.cpp2"
::outer::mytype var {};
std::cout << CPP2_UFCS(g, var, 42) << "\n";
std::cout << CPP2_UFCS(g)(var, 42) << "\n";

std::cout << [&] () -> namespace_alias::string { auto&& __expr = CPP2_UFCS(g, std::move(var), 42);
std::cout << [&] () -> namespace_alias::string { auto&& __expr = CPP2_UFCS(g)(std::move(var), 42);
if (cpp2::is(__expr, 43)) { if constexpr( requires{"forty-and-three";} ) if constexpr( std::is_convertible_v<CPP2_TYPEOF(("forty-and-three")),namespace_alias::string> ) return "forty-and-three"; else return namespace_alias::string{}; else return namespace_alias::string{}; }
else return "default case"; }
() << "\n";
Expand Down
10 changes: 5 additions & 5 deletions regression-tests/test-results/pure2-union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ auto name_or_number::destroy() & -> void{
name_or_number::~name_or_number() noexcept{destroy();}
#line 7 "pure2-union.cpp2"
auto print_name(cpp2::in<name_or_number> non) -> void{
if (CPP2_UFCS_0(is_name, non)) {
std::cout << CPP2_UFCS_0(get_name, non) << "\n";
if (CPP2_UFCS(is_name)(non)) {
std::cout << CPP2_UFCS(get_name)(non) << "\n";
}
else {
std::cout << "(not a name)\n";
Expand All @@ -82,10 +82,10 @@ auto main() -> int{
name_or_number x {};
std::cout << "sizeof(x) is " + cpp2::to_string(sizeof(x)) + "\n";

CPP2_UFCS_0(print_name, x);
CPP2_UFCS(print_name)(x);

CPP2_UFCS(set_name, x, "xyzzy", cpp2::as_<cpp2::u8, 3>());
CPP2_UFCS(set_name)(x, "xyzzy", cpp2::as_<cpp2::u8, 3>());

CPP2_UFCS_0(print_name, std::move(x));
CPP2_UFCS(print_name)(std::move(x));
}

0 comments on commit c24da88

Please sign in to comment.