godotengine / godotengine/godot
`@export_storage` is missing parser safeguards
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Tested in 4.3beta6
### System information
Godot v4.3.beta (d15597767) - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.4601) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)
### Issue description
Exports are limited to built-in types, resources, nodes, or enums. However, `@export_storage` can accept invalid types (such as inner classes). This causes bizarre, unpredictable editor instability (like the resource script being resaved into the scene, or new scripts manifesting in the scripts panel).
This raises the parser error `Export type can only be built-in, a resource, a node, or an enum.`
```gdscript
class Item:
pass
@export var item: Item
```
This raises no parser error.
```gdscript
class Item:
pass
@export_storage var item: Item
```
### Steps to reproduce
1. Create an invalid `@export` using an inner class.
2. Swap it to `@export_storage`.
### Minimal reproduction project (MRP)
[export_issue_mrp.zip](https://github.com/user-attachments/files/16200017/export_issue_mrp.zip)
Contributor guide
Assessment
This issue has not been assessed yet.