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

}
	parse_class_body(true);
	complete_extents(head);
#ifdef TOOLS_ENABLED
	for (const KeyValue<int, GDScriptTokenizer::CommentData> &E : tokenizer.get_comments()) {
		if (E.value.new_line && E.value.comment.begins_with("##")) {
			class_doc_line = MIN(class_doc_line, E.key);
		}
	}
	if (has_comment(class_doc_line)) {
		get_class_doc_comment(class_doc_line, head->doc_brief_description, head->doc_description, head->doc_tutorials, false);
	}
#endif 
	if (!check(GDScriptTokenizer::Token::TK_EOF)) {
		push_error("Expected end of file.");
	}
	clear_unused_annotations();
}
GDScriptParser::ClassNode *GDScriptParser::find_class(const String &p_qualified_name) const {
	String first = p_qualified_name.get_slice("::", 0);
	Vector<String> class_names;
	GDScriptParser::ClassNode *result = nullptr;
	
	if (first.is_empty() || (head->identifier && first == head->identifier->name)) {
		class_names = p_qualified_name.split("::");
		result = head;
	} else if (p_qualified_name.begins_with(script_path)) {
		
		class_names = p_qualified_name.trim_prefix(script_path).split("::");
		result = head;