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

if (is_type_compatible(this_element_type, element_type, false)) {
							
							element_type = this_element_type;
						} else {
							
							all_same_type = false;
							break;
						}
					}
				}
			}
		}
		if (all_same_type) {
			element_type.is_constant = false;
			array_type.set_container_element_type(element_type);
		} else if (all_have_type) {
			push_error(vformat(R"(Variant array is not compatible with an array of type "%s".)", p_base_type.get_container_element_type().to_string()), p_array_literal);
		}
	}
	
	p_array_literal->set_datatype(array_type);
}
void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assignment) {
	reduce_expression(p_assignment->assignee);
	reduce_expression(p_assignment->assigned_value);
	if (p_assignment->assigned_value == nullptr || p_assignment->assignee == nullptr) {
		return;
	}
	GDScriptParser::DataType assignee_type = p_assignment->assignee->get_datatype();
	if (assignee_type.is_constant || (p_assignment->assignee->type == GDScriptParser::Node::SUBSCRIPT && static_cast<GDScriptParser::SubscriptNode *>(p_assignment->assignee)->base->is_constant)) {