Skip to content

Commit def17e6

Browse files
committed
Merge pull request #108650 from Calinou/doc-projectsettings-type-inference
Clarify type inference in ProjectSettings Inferred Declaration warning
2 parents f20ef37 + 56f355e commit def17e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/classes/ProjectSettings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a static inferred type uses a [Variant] as initial value, which makes the static type to also be Variant.
554554
</member>
555555
<member name="debug/gdscript/warnings/inferred_declaration" type="int" setter="" getter="" default="0">
556-
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a variable, constant, or parameter has an implicitly inferred static type.
556+
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a variable, constant, or parameter has an implicitly inferred static type. In GDScript, type inference is performed by declaring a variable with [code]:=[/code] instead of [code]=[/code] and leaving out the type specifier. For example, [code]var x := 1[/code] will [i]infer[/i] the [int] type, while [code]var x: int = 1[/code] explicitly declares the variable as [int].
557557
[b]Note:[/b] This warning is recommended [i]in addition[/i] to [member debug/gdscript/warnings/untyped_declaration] if you want to always specify the type explicitly. Having [code]INFERRED_DECLARATION[/code] warning level higher than [code]UNTYPED_DECLARATION[/code] warning level makes little sense and is not recommended.
558558
</member>
559559
<member name="debug/gdscript/warnings/int_as_enum_without_cast" type="int" setter="" getter="" default="1">

0 commit comments

Comments
 (0)