Skip to content

Commit 8819ecd

Browse files
committed
Add Axiom contract group that is never evaluated (lowers to nothing)
For now the condition just has to be grammatical. We can even relax that if we want... I don't currently know of a reason we would want to allow an arbitrary token sequence there, but if there is that would be easy to allow
1 parent 580b83a commit 8819ecd

12 files changed

+41
-0
lines changed

regression-tests/pure2-contracts.cpp2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
main: () = {
2+
assert( 1 != 2, "ack, arithmetic is buggy" );
3+
assert<Type>( typeid(int) != typeid(double), "ack, C types are broken" );
4+
assert<Axiom>( any-grammatical.kind(of, nonsense * here) is "all ignored" );
5+
}

regression-tests/test-results/clang-12/pure2-contracts.cpp.execution

Whitespace-only changes.

regression-tests/test-results/clang-12/pure2-contracts.cpp.output

Whitespace-only changes.

regression-tests/test-results/gcc-10/pure2-contracts.cpp.execution

Whitespace-only changes.

regression-tests/test-results/gcc-10/pure2-contracts.cpp.output

Whitespace-only changes.

regression-tests/test-results/gcc-13/pure2-contracts.cpp.execution

Whitespace-only changes.

regression-tests/test-results/gcc-13/pure2-contracts.cpp.output

Whitespace-only changes.

regression-tests/test-results/msvc-2022/pure2-contracts.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-contracts.cpp
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
#define CPP2_IMPORT_STD Yes
3+
4+
//=== Cpp2 type declarations ====================================================
5+
6+
7+
#include "cpp2util.h"
8+
9+
#line 1 "pure2-contracts.cpp2"
10+
11+
12+
//=== Cpp2 type definitions and function declarations ===========================
13+
14+
#line 1 "pure2-contracts.cpp2"
15+
auto main() -> int;
16+
17+
//=== Cpp2 function definitions =================================================
18+
19+
#line 1 "pure2-contracts.cpp2"
20+
auto main() -> int{
21+
#line 2 "pure2-contracts.cpp2"
22+
cpp2::Default.expects(1 != 2, "ack, arithmetic is buggy");
23+
cpp2::Type.expects(typeid(int) != typeid(double), "ack, C types are broken");
24+
25+
}
26+

0 commit comments

Comments
 (0)