Skip to content

Commit 4d86f91

Browse files
authored
Add note in GDScript reference about inference with Variant (#6934)
1 parent 74b9f0b commit 4d86f91

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tutorials/scripting/gdscript/gdscript_basics.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,16 @@ Valid types are:
760760
- Script classes declared with the ``class_name`` keyword.
761761
- Autoloads registered as singletons.
762762

763+
.. note::
764+
765+
While ``Variant`` is a valid type specification, it's not an actual type. It
766+
only means there's no set type and is equivalent to not having a static type
767+
at all. Therefore, inference is not allowed by default for ``Variant``,
768+
since it's likely a mistake.
769+
770+
You can turn off this check, or make it only a warning, by changing it in
771+
the project settings. See :ref:`doc_gdscript_warning_system` for details.
772+
763773
Casting
764774
^^^^^^^
765775

0 commit comments

Comments
 (0)