mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Allow doc comments on individual struct members, faultdefs and enum values #2427.
This commit is contained in:
41
test/test_suite/errors/contracts_in_defs.c3
Normal file
41
test/test_suite/errors/contracts_in_defs.c3
Normal file
@@ -0,0 +1,41 @@
|
||||
module test;
|
||||
import std;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
<* hello *>
|
||||
int a;
|
||||
<* test *>
|
||||
union
|
||||
{
|
||||
<* test2 *>
|
||||
int b;
|
||||
}
|
||||
struct foo
|
||||
{
|
||||
<* baz *>
|
||||
int g;
|
||||
}
|
||||
}
|
||||
|
||||
faultdef <* hello *> FOO;
|
||||
enum Abc
|
||||
{
|
||||
<* test *>
|
||||
XYZ
|
||||
}
|
||||
|
||||
faultdef <* @require a > 0 *> FOO2; // #error: No constraints are allowed on faults
|
||||
enum Abc2
|
||||
{
|
||||
<* @require a > 0 *> // #error: No constraints are allowed on enum values
|
||||
XYZ
|
||||
}
|
||||
struct Test
|
||||
{
|
||||
<* @require a > 0 *> // #error: No constraints are allowed on struct/union members
|
||||
int a;
|
||||
}
|
||||
|
||||
fn void main()
|
||||
{}
|
||||
Reference in New Issue
Block a user