Godot: A type hint of null should trigger a warning

Created on 18 Nov 2019  路  2Comments  路  Source: godotengine/godot

Godot version:
3.2 beta 1

OS/device including version:
Windows 7 64bit

Issue description:
A type hint for null should trigger a warning.

Steps to reproduce:
Paste the following code in a new GD-Script file and run the scene.
In my opinion the code should trigger a warning, becuase we are using x like a constant for null.
When we try to assign 42 to x, the value stays unchanged.

```
extends Node

var x := null

func _ready():
x = 42
print(x) # Prints "null"
```

bug gdscript

Most helpful comment

Or it could trigger an error, since a null-typed variable is quite pointless.

All 2 comments

Or it could trigger an error, since a null-typed variable is quite pointless.

In the current version of Godot(3.2.2rc2) the bug is fixed aka the code throws an error.

https://github.com/godotengine/godot/pull/38610

Was this page helpful?
0 / 5 - 0 ratings