Skip to content

Commit cdfe121

Browse files
committed
Update tests to exercise the terse function syntax more
1 parent 785c44d commit cdfe121

13 files changed

+24
-24
lines changed

regression-tests/mixed-captures-in-expressions-and-postconditions.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ main: () -> int = {
77
= ("hello", "2022");
88

99
y: std::string = "\n";
10-
callback := :(x:_) = { std::cout << x << y&$*; };
10+
callback := :(x) = std::cout << x << y&$*;
1111

1212
std::ranges::for_each( vec, callback );
1313
y = "-ish\n";

regression-tests/mixed-function-expression-and-std-for-each.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ main: () -> int = {
1313
std::for_each(
1414
view.begin(),
1515
view.end(),
16-
:(inout x:_) = x += "-ish";
16+
:(inout x) = x += "-ish";
1717
);
1818

1919
// Initializing from a function expression
20-
callback := :(inout x:_) = x += " maybe";
20+
callback := :(inout x) = x += " maybe";
2121
std::for_each(
2222
view.begin(),
2323
view.end(),

regression-tests/mixed-function-expression-and-std-ranges-for-each-with-capture.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ main: () -> int = {
1212

1313
y := "\n";
1414
std::ranges::for_each
15-
( view, :(x:_) = { std::cout << x << y$; } );
15+
( view, :(x) = std::cout << x << y$ );
1616

17-
callback := :(inout x:_) = x += "-ish";
17+
callback := :(inout x) = x += "-ish";
1818
std::ranges::for_each( view, callback );
1919

2020
for view do (str)

regression-tests/mixed-function-expression-and-std-ranges-for-each.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ main: () -> int = {
1111
view: std::span = vec;
1212

1313
std::ranges::for_each
14-
( view, :(x:_) = { std::cout << x << "\n"; } );
14+
( view, :(x) = std::cout << x << "\n" );
1515

16-
callback := :(inout x:_) = x += "-ish";
16+
callback := :(inout x) = x += "-ish";
1717
std::ranges::for_each( view, callback );
1818

1919
for view do (str)

regression-tests/mixed-function-expression-with-pointer-capture.cpp2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ main: () -> int = {
1111
view: std::span = vec;
1212

1313
y: std::string = "\n";
14-
std::ranges::for_each( view, :(x:_) = {
15-
std::cout << (y&$)*.c_str() << x << y&$*;
16-
} );
14+
std::ranges::for_each( view, :(x) =
15+
std::cout << y&$*.c_str() << x << y&$*;
16+
);
1717

18-
callback := :(inout x:_) = x += "-ish";
18+
callback := :(inout x) = x += "-ish";
1919
std::ranges::for_each( view, callback );
2020

2121
for view do (str)

regression-tests/mixed-function-expression-with-repeated-capture.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ main: () -> int = {
1212

1313
y := "\n";
1414
std::ranges::for_each
15-
( view, :(x:_) = { std::cout << y$ << x << y$; } );
15+
( view, :(x) = std::cout << y$ << x << y$ );
1616

17-
callback := :(inout x:_) = x += "-ish";
17+
callback := :(inout x) = x += "-ish";
1818
std::ranges::for_each( view, callback );
1919

2020
for view do (str)

regression-tests/pure2-look-up-parameter-across-unnamed-function.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
f: () -> (ri : int = 0) = {
3-
pred := :(e:_) -> bool = { return e == 1; };
3+
pred := :(e) e == 1;
44
ri = 42;
55
// "return;" is implicit"
66
}
77

88
g: () -> (ri : int) = {
99
ri = 0;
10-
pred := :(e:_) -> bool = { return e == 1; };
10+
pred := :(e) e == 1;
1111
ri = 42;
1212
return;
1313
}

regression-tests/test-results/mixed-captures-in-expressions-and-postconditions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;
3232
"hello", "2022"};
3333

3434
std::string y {"\n"};
35-
auto callback {[_0 = (&y)](auto const& x) -> void{std::cout << x << *cpp2::assert_not_null(_0); }};
35+
auto callback {[_0 = (&y)](auto const& x) -> void { std::cout << x << *cpp2::assert_not_null(_0); }};
3636

3737
std::ranges::for_each(vec, callback);
3838
y = "-ish\n";

regression-tests/test-results/mixed-function-expression-and-std-ranges-for-each-with-capture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
auto y {"\n"};
3333
std::ranges::for_each
34-
(view, [_0 = std::move(y)](auto const& x) -> void{std::cout << x << _0; });
34+
(view, [_0 = std::move(y)](auto const& x) -> void { std::cout << x << _0; });
3535

3636
auto callback {[](auto& x) -> void { x += "-ish"; }};
3737
std::ranges::for_each(view, std::move(callback));

regression-tests/test-results/mixed-function-expression-and-std-ranges-for-each.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
std::span view {vec};
3131

3232
std::ranges::for_each
33-
(view, [](auto const& x) -> void{std::cout << x << "\n"; });
33+
(view, [](auto const& x) -> void { std::cout << x << "\n"; });
3434

3535
auto callback {[](auto& x) -> void { x += "-ish"; }};
3636
std::ranges::for_each(view, std::move(callback));

0 commit comments

Comments
 (0)