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

StringName elem_type_name = p_property.hint_string;
			GDScriptParser::DataType elem_type;
			elem_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
			Variant::Type elem_builtin_type = GDScriptParser::get_builtin_type(elem_type_name);
			if (elem_builtin_type < Variant::VARIANT_MAX) {
				
				elem_type.kind = GDScriptParser::DataType::BUILTIN;
				elem_type.builtin_type = elem_builtin_type;
			} else if (class_exists(elem_type_name)) {
				elem_type.kind = GDScriptParser::DataType::NATIVE;
				elem_type.builtin_type = Variant::OBJECT;
				elem_type.native_type = p_property.hint_string;
			} else if (ScriptServer::is_global_class(elem_type_name)) {
				
				Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(elem_type_name));
				elem_type.kind = GDScriptParser::DataType::SCRIPT;
				elem_type.builtin_type = Variant::OBJECT;
				elem_type.native_type = script->get_instance_base_type();
				elem_type.script_type = script;
			} else {
				ERR_FAIL_V_MSG(result, "Could not find element type from property hint of a typed array.");
			}
			elem_type.is_constant = false;
			result.set_container_element_type(elem_type);
		}
	}
	return result;
}
bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bool p_is_constructor, GDScriptParser::DataType p_base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg) {