### 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)

GDScriptParser::DataType array_type = p_array_literal->get_datatype();
	if (p_array_literal->elements.size() == 0) {
		
		array_type.set_container_element_type(p_base_type.get_container_element_type());
	} else {
		
		bool all_same_type = true;
		bool all_have_type = true;
		GDScriptParser::DataType element_type;
		for (int i = 0; i < p_array_literal->elements.size(); i++) {
			if (i == 0) {
				element_type = p_array_literal->elements[0]->get_datatype();
			} else {
				GDScriptParser::DataType this_element_type = p_array_literal->elements[i]->get_datatype();
				if (this_element_type.has_no_type()) {
					all_same_type = false;
					all_have_type = false;
					break;
				} else if (element_type != this_element_type) {
					if (!is_type_compatible(element_type, this_element_type, false)) {