static_typing: Cyclic type dependencies and enums as types are now possible

This commit is contained in:
Mara Huldra
2022-12-18 18:24:22 +01:00
parent 80ba4c0277
commit 66c620583f

View File

@@ -331,13 +331,6 @@ Cases where you can't specify types
To wrap up this introduction, let's cover a few cases where you can't
use type hints. All the examples below **will trigger errors**.
You can't use Enums as types:
::
enum MoveDirection {UP, DOWN, LEFT, RIGHT}
var current_direction: MoveDirection
You can't specify the type of individual members in an array. This will
give you an error:
@@ -355,28 +348,6 @@ element the ``for`` keyword loops over already has a different type. So you
for name: String in names:
pass
Two scripts can't depend on each other in a cyclic fashion:
::
# Player.gd
extends Area2D
class_name Player
var rifle: Rifle
::
# Rifle.gd
extends Area2D
class_name Rifle
var player: Player
Summary
-------