Skip to content

Commit 7baeb75

Browse files
authored
Fix compiler panic (#29290)
Fixes #29224 Return proper error type preventing fetching a finalization that does not exist.
1 parent bd8b1de commit 7baeb75

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

crates/passes/src/type_checking/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,7 @@ impl AstVisitor for TypeCheckingVisitor<'_> {
11521152
if self.async_block_id.is_some() && !matches!(func.variant, Variant::FinalFn | Variant::Fn) {
11531153
// FIXME better error
11541154
self.emit_err(TypeCheckerError::can_only_call_inline_function("a final block", input.span));
1155+
return Type::Err;
11551156
}
11561157

11571158
// Async functions return a single future.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Error [ETYC0372043]: Cannot call a local entry point fn from an entry point fn.
2+
--> compiler-test:7:13
3+
|
4+
7 | baz();
5+
| ^^^^^
6+
Error [ETYC0372042]: Only regular fns can be called from a final block.
7+
--> compiler-test:7:13
8+
|
9+
7 | baz();
10+
| ^^^^^
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
program test.aleo {
3+
storage counter: u8;
4+
5+
fn bar() -> Final {
6+
return final {
7+
baz();
8+
};
9+
}
10+
11+
fn baz() -> Final {
12+
return final {
13+
counter = 1u8;
14+
};
15+
}
16+
17+
@noupgrade
18+
constructor() {}
19+
}

0 commit comments

Comments
 (0)