GDScript: Fix type deduction for functions without return statements

This commit is contained in:
Danil Alexeev
2026-03-31 14:00:41 +03:00
parent caf16709af
commit 8299b03c1a
9 changed files with 253 additions and 51 deletions
@@ -443,9 +443,6 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
method_doc.return_type = "void";
} else if (!m_func->get_datatype().is_variant()) {
_doctype_from_gdtype(m_func->get_datatype(), method_doc.return_type, method_doc.return_enum, true);
} else if (!m_func->body->has_return) {
// If no `return` statement, then return type is `void`, not `Variant`.
method_doc.return_type = "void";
} else {
method_doc.return_type = "Variant";
}