| ... | ... | @@ -4174,8 +4174,14 @@ static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { |
| 4174 | 4174 | assert(fn->inferred_async_node != inferred_async_checking); |
| 4175 | 4175 | assert(fn->inferred_async_node != inferred_async_none); |
| 4176 | 4176 | if (fn->inferred_async_fn != nullptr) { |
| 4177 | | ErrorMsg *new_msg = add_error_note(g, msg, fn->inferred_async_node, |
| 4178 | | buf_sprintf("async function call here")); |
| 4177 | ErrorMsg *new_msg; |
| 4178 | if (fn->inferred_async_node->type == NodeTypeAwaitExpr) { |
| 4179 | new_msg = add_error_note(g, msg, fn->inferred_async_node, |
| 4180 | buf_create_from_str("await here is a suspend point")); |
| 4181 | } else { |
| 4182 | new_msg = add_error_note(g, msg, fn->inferred_async_node, |
| 4183 | buf_sprintf("async function call here")); |
| 4184 | } |
| 4179 | 4185 | return add_async_error_notes(g, new_msg, fn->inferred_async_fn); |
| 4180 | 4186 | } else if (fn->inferred_async_node->type == NodeTypeFnProto) { |
| 4181 | 4187 | add_error_note(g, msg, fn->inferred_async_node, |
| ... | ... | @@ -4185,7 +4191,7 @@ static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { |
| 4185 | 4191 | buf_sprintf("suspends here")); |
| 4186 | 4192 | } else if (fn->inferred_async_node->type == NodeTypeAwaitExpr) { |
| 4187 | 4193 | add_error_note(g, msg, fn->inferred_async_node, |
| 4188 | | buf_sprintf("await is a suspend point")); |
| 4194 | buf_sprintf("await here is a suspend point")); |
| 4189 | 4195 | } else if (fn->inferred_async_node->type == NodeTypeFnCallExpr && |
| 4190 | 4196 | fn->inferred_async_node->data.fn_call_expr.is_builtin) |
| 4191 | 4197 | { |
| ... | ... | @@ -4240,6 +4246,16 @@ static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode |
| 4240 | 4246 | add_async_error_notes(g, msg, fn); |
| 4241 | 4247 | return ErrorSemanticAnalyzeFail; |
| 4242 | 4248 | } |
| 4249 | if (fn->assumed_non_async != nullptr) { |
| 4250 | ErrorMsg *msg = add_node_error(g, fn->proto_node, |
| 4251 | buf_sprintf("unable to infer whether '%s' should be async", |
| 4252 | buf_ptr(&fn->symbol_name))); |
| 4253 | add_error_note(g, msg, fn->assumed_non_async, |
| 4254 | buf_sprintf("assumed to be non-async here")); |
| 4255 | add_async_error_notes(g, msg, fn); |
| 4256 | fn->anal_state = FnAnalStateInvalid; |
| 4257 | return ErrorSemanticAnalyzeFail; |
| 4258 | } |
| 4243 | 4259 | return ErrorIsAsync; |
| 4244 | 4260 | } |
| 4245 | 4261 | return ErrorNone; |