diff --git a/src/dreamchecker/lib.rs b/src/dreamchecker/lib.rs index 21c7565e6..bd3a62e68 100644 --- a/src/dreamchecker/lib.rs +++ b/src/dreamchecker/lib.rs @@ -1281,6 +1281,11 @@ impl<'o, 's> AnalyzeProc<'o, 's> { }, Statement::Return(Some(expr)) => { // TODO: factor in the previous return type if there was one + if self.inside_newcontext > 0 { + error(location, "returning a value in a spawn has no effect") + .set_severity(Severity::Warning) + .register(self.context); + } let return_type = self.visit_expression(location, expr, None, local_vars); local_vars.get_mut(".").unwrap().analysis = return_type; return ControlFlow { returns: true, continues: false, breaks: false, fuzzy: false }