diff --git a/releasenotes.md b/releasenotes.md index dc8de1753..61262f81f 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -18,6 +18,7 @@ - `l[0].a = 1` now supported for overloads due to better lvalue handling #1357. - Asserts are retained regardless of optimization when running tests. - Limit object filename lengths. #1415 +- Fix regression for `$include`. ### Stdlib changes - Additional init functions for hashmap. diff --git a/src/compiler/sema_passes.c b/src/compiler/sema_passes.c index 34d479e6d..d4de59afa 100644 --- a/src/compiler/sema_passes.c +++ b/src/compiler/sema_passes.c @@ -150,7 +150,7 @@ INLINE File *sema_load_file(CompilationUnit *unit, SourceSpan span, Expr *filena if (!file) { if (no_file) return no_file; - print_error_at(span, "Failed to load file %s: %s", string, error); + print_error_at(filename->span, "Failed to load file '%s': %s.", filename->const_expr.bytes.ptr, error); return NULL; } if (compiler.context.errors_found) return NULL; @@ -174,7 +174,7 @@ static Decl **sema_load_include(CompilationUnit *unit, Decl *decl) } bool success = sema_analyse_ct_expr(&context, decl->include.filename); sema_context_destroy(&context); - if (success) return NULL; + if (!success) return NULL; File *file = sema_load_file(unit, decl->span, decl->include.filename, "$include", NULL); if (!file) return NULL; if (compiler.context.includes_used++ > MAX_INCLUDE_DIRECTIVES)