commit 1bd4983f20e77691090bff63eb76c4623a0b4d24
parent 69f14f3c2c98a9d030af519a8f0f1cadf88227a0
Author: m21c <ho*******@gmail.com>
Date: Thu, 25 Jun 2026 07:38:31 +0200
fix: pending env should only typechecked, etc. in processpendingenvs
Diffstat:
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -8374,6 +8374,22 @@ errorlength:
return false;
}
+static bool
+isnodepending(Source *source, Node *ast)
+{
+ Decl *decl;
+
+ if (ast->kind != ADECL)
+ return false;
+
+ decl = ast->u.declref;
+ if (decl->kind != DFUNCTION)
+ return false;
+
+ assert(decl->contentenv);
+ return decl->contentenv->pending;
+}
+
static Node *
toplevel(Source *source, Block *block)
{
@@ -8473,9 +8489,10 @@ redo:
printast(ast, 0);
printf("\n");
*/
- if (ast->kind != ADECL ||
- !ast->u.payload ||
- ast->u.payload->kind != ASCOPE)
+ if ((ast->kind != ADECL
+ || !ast->u.payload
+ || ast->u.payload->kind != ASCOPE)
+ && !isnodepending(source, ast))
{
ast = typecheck(source->currenv, ast);
ast = foldexpr(source->currenv, ast);