diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 7a83f77835..058162ae8a 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -97,7 +97,7 @@ var numbers = PackedInt32Array([0, 0, 0]) func _get_property_list(): - var properties = [] + var properties: Array[Dictionary] = [] for i in range(number_count): properties.append({ diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 0fb2de8914..f9f9567ec2 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1741,9 +1741,48 @@ void GDScriptInstance::get_property_list(List *p_properties) const Callable::CallError err; Variant ret = E->value->call(const_cast(this), nullptr, 0, err); if (err.error == Callable::CallError::CALL_OK) { - ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, "Wrong type for _get_property_list, must be an array of dictionaries."); + // GH-118877. We decided to make an exception to maintain compatibility, since the problem can only be detected at runtime. +#ifdef DISABLE_DEPRECATED + ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, R"*(Wrong type for "_get_property_list()", must be "Array[Dictionary]".)*"); +#else // !DISABLE_DEPRECATED + ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, R"*(Wrong type for "_get_property_list()", must be an array of dictionaries.)*"); +#endif // DISABLE_DEPRECATED Array arr = ret; + + // GH-118877. We decided to make an exception to maintain compatibility, since the problem can only be detected at runtime. +#ifdef DISABLE_DEPRECATED + ERR_FAIL_COND_MSG(arr.get_typed_builtin() != Variant::DICTIONARY, R"*(Wrong type for "_get_property_list()", must be "Array[Dictionary]".)*"); +#else // !DISABLE_DEPRECATED +#ifdef DEBUG_ENABLED + if (arr.get_typed_builtin() != Variant::DICTIONARY) { + static bool error_shown = false; + if (unlikely(!error_shown)) { + error_shown = true; + + String elem_type; + if (arr.is_typed()) { + const Ref