We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5e61ec commit 0ac8a24Copy full SHA for 0ac8a24
compiler/passes/src/type_checking/visitor.rs
@@ -1198,7 +1198,9 @@ impl TypeCheckingVisitor<'_> {
1198
// Check that the function context matches.
1199
if self.scope_state.variant == Some(Variant::AsyncFunction) && !finalize_op {
1200
self.state.handler.emit_err(TypeCheckerError::invalid_operation_inside_finalize(name, span))
1201
- } else if self.scope_state.variant != Some(Variant::AsyncFunction) && finalize_op {
+ } else if !matches!(self.scope_state.variant, Some(Variant::AsyncFunction) | Some(Variant::Script))
1202
+ && finalize_op
1203
+ {
1204
self.state.handler.emit_err(TypeCheckerError::invalid_operation_outside_finalize(name, span))
1205
}
1206
0 commit comments