Skip to content

Commit 0ac8a24

Browse files
committed
script should be able to use finalize ops
1 parent b5e61ec commit 0ac8a24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/passes/src/type_checking/visitor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,9 @@ impl TypeCheckingVisitor<'_> {
11981198
// Check that the function context matches.
11991199
if self.scope_state.variant == Some(Variant::AsyncFunction) && !finalize_op {
12001200
self.state.handler.emit_err(TypeCheckerError::invalid_operation_inside_finalize(name, span))
1201-
} else if self.scope_state.variant != Some(Variant::AsyncFunction) && finalize_op {
1201+
} else if !matches!(self.scope_state.variant, Some(Variant::AsyncFunction) | Some(Variant::Script))
1202+
&& finalize_op
1203+
{
12021204
self.state.handler.emit_err(TypeCheckerError::invalid_operation_outside_finalize(name, span))
12031205
}
12041206
}

0 commit comments

Comments
 (0)