diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2023-12-30 23:39:37 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2023-12-30 23:39:37 +0100 |
| commit | 263915832993dd12beee10e204f9ebcc6c786ed2 (patch) | |
| tree | 862e51208a99c35746e574a76564a4532b3a4a49 /CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2 | |
Meta: initial commit of WestCo optimized toolchain.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2')
| -rw-r--r-- | CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2 b/CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2 new file mode 100644 index 0000000..7842e59 --- /dev/null +++ b/CompilerDriver/cc2/regression-tests/mixed-postexpression-with-capture.cpp2 @@ -0,0 +1,38 @@ +#include <vector> +#include <ranges> +#include <string> +#include <span> +#include <algorithm> +#include <iostream> + +main: () -> int = { + insert_at( 0, 42 ); + std::cout << make_string() + "plugh\n"; + std::cout << make_strings().a + make_strings().b + "\n"; +} + +vec: std::vector<int> = (); + +insert_at: (where: int, val: int) + pre ( 0 <= where && where <= vec.ssize() ) + post( vec.size() == vec.size()$ + 1 ) += { + vec.push_back(val); +} + +make_string: () -> (ret: std::string = "xyzzy") + post (ret.length() == ret.length()$ + 5) += { + ret += " and "; +} + +make_strings: () +-> ( + a: std::string = "xyzzy", + b: std::string = "plugh" + ) + post (a.length() == b.length() == 5) += { + // 'return' is generated when omitted like this +} + |
