Skip to content

Commit 5a46a02

Browse files
authored
Fix misplaced bad example
Moved the bad example for the inferred type for functions that return super types directly after its related statement.
1 parent cce8630 commit 5a46a02

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tutorials/scripting/gdscript/gdscript_styleguide.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,16 @@ the function's return type. For example, ``get_node()`` cannot infer a type
10321032
unless the scene or file of the node is loaded in memory. In this case, you
10331033
should set the type explicitly.
10341034

1035+
**Bad**:
1036+
1037+
.. rst-class:: code-example-bad
1038+
1039+
::
1040+
1041+
# The compiler can't infer the exact type and will use Node
1042+
# instead of ProgressBar.
1043+
@onready var health_bar := get_node("UI/LifeBar")
1044+
10351045
**Good**:
10361046

10371047
.. rst-class:: code-example-good
@@ -1052,12 +1062,4 @@ that type will be used to infer the type of the var.
10521062

10531063
This option is also considered more :ref:`type-safe<doc_gdscript_static_typing_safe_lines>` than the first.
10541064

1055-
**Bad**:
10561065

1057-
.. rst-class:: code-example-bad
1058-
1059-
::
1060-
1061-
# The compiler can't infer the exact type and will use Node
1062-
# instead of ProgressBar.
1063-
@onready var health_bar := get_node("UI/LifeBar")

0 commit comments

Comments
 (0)