Multiline contract comments #2113

This commit is contained in:
Christoffer Lerno
2025-07-11 01:18:58 +02:00
parent 8a62c12089
commit 02c0db7b8b
12 changed files with 209 additions and 58 deletions

View File

@@ -0,0 +1,40 @@
module contract_err_tests;
<*
Hello world
@param [in] a
: "param description"
@require 1 == 2 : "Some text, "
"that" " continues "
`-here `
@require 1 = 1
@return "hello"
"world"
@return? io::EOF :
"errors"
*>
macro usz @a(a) => a;
<*
Hello world
@param [in] a :
"param description"
@require 1 == 2
:
"Some text, "
"that" " continues "
`-here `
@require 1 = 1
@return
"hello"
"world"
@return? io::EOF
: "errors"
*>
macro usz @b(a) => a;
fn int main()
{
usz t = @a(1); // #error: 'Some text, that continues -here '
return 0;
}

View File

@@ -37,7 +37,7 @@ struct TextTag
}
<*
@require self.tags.len == 0 "template already initialized"
@require self.tags.len == 0 : "template already initialized"
@require tag_start != tag_end
*>
fn void? TextTemplate.init(&self, String template, String tag_start = "{{", String tag_end = "}}", Allocator using = allocator::heap())