godotengine / godotengine/godot
Using enum from other class as a signal parameter type doesn't work as expected
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in Godot v4.4.dev3.mono
### System information
Godot v4.4.dev3.mono - Windows 10.0.19045 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz (4 threads)
### Issue description
Creating a signal that uses enum from some other class (`SubNode` in this case) works weirdly. My expectation is that you should use the full path of the enum, in this case `SubNode.Foo`:
```gdscript
signal signal_using_enum_from_another_class1(SubNode.Foo)
```
But you get an error message:
```
Parse Error: Expected closing ")" after signal parameters.
```
However, if only the enum name without class is given, signal definition works:
```gdscript
signal signal_using_enum_from_another_class2(Foo)
```
Using enum from the same class also works.
I didn't test what happens if multiple classes have an enum with same name.
### Steps to reproduce

subnode.gd:
```gdscript
class_name SubNode
extends Node2D
enum Foo {BAR}
```
main.gd
```gdscript
extends Node2D
enum MyEnum {ZAP}
signal signal_using_my_enum(MyEnum)
var a: SubNode.Foo
signal signal_using_enum_from_another_class1(SubNode.Foo) # <---- error
signal signal_using_enum_from_another_class2(Foo) # <---- for some reason this works
```
### Minimal reproduction project (MRP)
[signal_enum_test.zip](https://github.com/user-attachments/files/17416676/signal_enum_test.zip)
Contributor guide
Research direction
Start with the attached minimal reproduction project, especially subnode.gd and main.gd, and run the signal declarations using SubNode.Foo and Foo. Trace the parser or type-resolution entry point for signal parameter types. Done means the qualified enum declaration parses and behaves consistently while the existing same-class enum cases still work.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100