Skip to content

Commit 14c5ef7

Browse files
committed
Revert "fix(cpp1): omit UFCS macro if the function is qualified"
This reverts commit 00ef370.
1 parent 00ef370 commit 14c5ef7

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

regression-tests/pure2-ufcs-member-access-and-chaining.cpp2

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ main: () -> int = {
1818

1919
_ = (j.i).ufcs();
2020

21-
_ = 42.std::to_string();
22-
2321
42.no_return();
2422
}
2523

regression-tests/test-results/pure2-ufcs-member-access-and-chaining.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
[[nodiscard]] auto main() -> int;
1414

1515

16-
#line 26 "pure2-ufcs-member-access-and-chaining.cpp2"
16+
#line 24 "pure2-ufcs-member-access-and-chaining.cpp2"
1717
auto no_return([[maybe_unused]] auto const& param1) -> void;
1818

1919
[[nodiscard]] auto ufcs(cpp2::in<int> i) -> int;
2020
struct fun_ret { int i; };
2121

2222

2323

24-
#line 32 "pure2-ufcs-member-access-and-chaining.cpp2"
24+
#line 30 "pure2-ufcs-member-access-and-chaining.cpp2"
2525
[[nodiscard]] auto fun() -> fun_ret;
2626

2727

28-
#line 37 "pure2-ufcs-member-access-and-chaining.cpp2"
28+
#line 35 "pure2-ufcs-member-access-and-chaining.cpp2"
2929
[[nodiscard]] auto get_i(auto const& r) -> int;
3030

3131

32-
#line 41 "pure2-ufcs-member-access-and-chaining.cpp2"
32+
#line 39 "pure2-ufcs-member-access-and-chaining.cpp2"
3333
// And a test for non-local UFCS, which shouldn't do a [&] capture
3434
[[nodiscard]] auto f([[maybe_unused]] auto const& param1) -> int;
3535
extern int y;
@@ -56,8 +56,6 @@ extern int y;
5656

5757
static_cast<void>(CPP2_UFCS(ufcs)((std::move(j).i)));
5858

59-
static_cast<void>(std::to_string(42));
60-
6159
CPP2_UFCS(no_return)(42);
6260
}
6361

@@ -69,7 +67,7 @@ auto no_return([[maybe_unused]] auto const& param1) -> void{}
6967

7068
[[nodiscard]] auto fun() -> fun_ret{
7169
cpp2::deferred_init<int> i;
72-
#line 33 "pure2-ufcs-member-access-and-chaining.cpp2"
70+
#line 31 "pure2-ufcs-member-access-and-chaining.cpp2"
7371
i.construct(42);
7472
return { std::move(i.value()) };
7573
}
@@ -78,7 +76,7 @@ auto no_return([[maybe_unused]] auto const& param1) -> void{}
7876
return r.i;
7977
}
8078

81-
#line 42 "pure2-ufcs-member-access-and-chaining.cpp2"
79+
#line 40 "pure2-ufcs-member-access-and-chaining.cpp2"
8280
[[nodiscard]] auto f([[maybe_unused]] auto const& param1) -> int { return 0; }
8381
int y {CPP2_UFCS_NONLOCAL(f)(0)};
8482

source/cppfront.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -3010,13 +3010,7 @@ class cppfront
30103010

30113011
// Second, emit the UFCS argument list
30123012

3013-
// If the function name is qualified, omit the UFCS macro entirely.
3014-
if (i->id_expr->is_qualified()) {
3015-
prefix.emplace_back(funcname + "(", args.value().open_pos );
3016-
} else {
3017-
prefix.emplace_back(ufcs_string + "(" + funcname + ")(", args.value().open_pos );
3018-
}
3019-
3013+
prefix.emplace_back(ufcs_string + "(" + funcname + ")(", args.value().open_pos );
30203014
suffix.emplace_back(")", args.value().close_pos );
30213015
if (!args.value().text_chunks.empty()) {
30223016
for (auto&& e: args.value().text_chunks) {

0 commit comments

Comments
 (0)