### Godot version

v4.0custom_build[fcba87e]

### System information

Windows 10

### Issue description

Error when trying to call a method with a ternary operator.

### Steps to reproduce

```
extends Node

func _ready() -> void:
	test() if true else test()

func test() -> void:
	pass
```
[fcba87e](https://github.com/godotengine/godot/commit/fcba87e696d58912838d8a4a6987b10efa28e78f) - `Line 4:Cannot get return value of call to "test()" because it returns "void".`

v4.0beta10 - works fine

### Minimal reproduction project

[ternary_bug.zip](https://github.com/godotengine/godot/files/10368477/ternary_bug.zip)

push_error(vformat(R"(%s in operator %s.)", p_binary_op->reduced_value, Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op);
				} else {
					push_error(vformat(R"(Invalid operands to operator %s, %s and %s.)",
									   Variant::get_operator_name(p_binary_op->variant_op),
									   Variant::get_type_name(p_binary_op->left_operand->reduced_value.get_type()),
									   Variant::get_type_name(p_binary_op->right_operand->reduced_value.get_type())),
							p_binary_op);
				}
			}
		} else {
			if (p_binary_op->operation == GDScriptParser::BinaryOpNode::OP_TYPE_TEST) {
				GDScriptParser::DataType test_type = right_type;
				test_type.is_meta_type = false;
				if (!is_type_compatible(test_type, left_type, false)) {
					push_error(vformat(R"(Expression is of type "%s" so it can't be of type "%s".)"), p_binary_op->left_operand);
					p_binary_op->reduced_value = false;
				} else {
					p_binary_op->reduced_value = true;
				}
			} else {
				ERR_PRINT("Parser bug: unknown binary operation.");
			}
		}
		p_binary_op->set_datatype(type_from_variant(p_binary_op->reduced_value, p_binary_op));
		return;
	}
	GDScriptParser::DataType result;
	if (left_type.is_variant() || right_type.is_variant()) {
		
		result.kind = GDScriptParser::DataType::VARIANT;