| ... | @@ -8514,10 +8514,10 @@ fn nodeMayEvalToError(tree: *const Ast, start_node: Ast.Node.Index) enum { never | ... | @@ -8514,10 +8514,10 @@ fn nodeMayEvalToError(tree: *const Ast, start_node: Ast.Node.Index) enum { never |
| 8514 | .unwrap_optional, | 8514 | .unwrap_optional, |
| 8515 | => node = node_datas[node].lhs, | 8515 | => node = node_datas[node].lhs, |
| 8516 | | 8516 | |
| 8517 | // Forward the question to the RHS sub-expression. | 8517 | // LHS sub-expression may still be an error under the outer optional or error union |
| 8518 | .@"catch", | 8518 | .@"catch", |
| 8519 | .@"orelse", | 8519 | .@"orelse", |
| 8520 | => node = node_datas[node].rhs, | 8520 | => return .maybe, |
| 8521 | | 8521 | |
| 8522 | .block_two, | 8522 | .block_two, |
| 8523 | .block_two_semicolon, | 8523 | .block_two_semicolon, |
| ... | @@ -8544,11 +8544,18 @@ fn nodeMayEvalToError(tree: *const Ast, start_node: Ast.Node.Index) enum { never | ... | @@ -8544,11 +8544,18 @@ fn nodeMayEvalToError(tree: *const Ast, start_node: Ast.Node.Index) enum { never |
| 8544 | // If the builtin is an invalid name, we don't cause an error here; instead | 8544 | // If the builtin is an invalid name, we don't cause an error here; instead |
| 8545 | // let it pass, and the error will be "invalid builtin function" later. | 8545 | // let it pass, and the error will be "invalid builtin function" later. |
| 8546 | const builtin_info = BuiltinFn.list.get(builtin_name) orelse return .maybe; | 8546 | const builtin_info = BuiltinFn.list.get(builtin_name) orelse return .maybe; |
| 8547 | if (builtin_info.tag == .err_set_cast) { | 8547 | return switch (builtin_info.tag) { |
| 8548 | return .always; | 8548 | .as, |
| 8549 | } else { | 8549 | .call, |
| 8550 | return .never; | 8550 | .field, |
| 8551 | } | 8551 | => .maybe, |
| | 8552 | |
| | 8553 | .err_set_cast, |
| | 8554 | .int_to_error, |
| | 8555 | => .always, |
| | 8556 | |
| | 8557 | else => .never, |
| | 8558 | }; |
| 8552 | }, | 8559 | }, |
| 8553 | } | 8560 | } |
| 8554 | } | 8561 | } |