Fix regression with contract docs and generics #1821

This commit is contained in:
Christoffer Lerno
2025-01-12 14:19:19 +01:00
parent f65ca07b62
commit 4e78e32ced
2 changed files with 16 additions and 2 deletions

View File

@@ -4444,9 +4444,10 @@ static bool sema_analyse_generic_module_contracts(SemaContext *c, Module *module
{
Ast *ast = astptr(contract);
contract = ast->next;
ASSERT0(ast->ast_kind == AST_CONTRACT);
ASSERT(ast, ast->ast_kind == AST_CONTRACT);
SemaContext temp_context;
ASSERT0(ast->contract_stmt.kind == CONTRACT_REQUIRE);
if (ast->contract_stmt.kind == CONTRACT_COMMENT) continue;
ASSERT(ast, ast->contract_stmt.kind == CONTRACT_REQUIRE);
SemaContext *new_context = context_transform_for_eval(c, &temp_context, module->units[0]);
FOREACH(Expr *, expr, ast->contract_stmt.contract.decl_exprs->expression_list)
{

View File

@@ -0,0 +1,13 @@
module test;
import generic;
// Issue #1821
fn void main() {
Generic(<int>) asdf;
}
<*
Hello
*>
module generic(<Param>);
struct Generic { int a; }