Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the argument list of signal is meaningless #99756

Closed
1e0nhardt opened this issue Nov 27, 2024 · 1 comment
Closed

the argument list of signal is meaningless #99756

1e0nhardt opened this issue Nov 27, 2024 · 1 comment

Comments

@1e0nhardt
Copy link

Tested versions

  • Reproducible in: 4.3.stable, 4.2.2.stable

System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Ti (NVIDIA; 32.0.15.6094) - 13th Gen Intel(R) Core(TM) i7-13700K (24 Threads)

Issue description

extends Control

signal test_signal
signal test_signal2
signal test_signal3(a, b, c, d, e, f, g)
signal test_signal4(a, b, c, d)

@onready var button: Button = $VBoxContainer/Button
@onready var button_2: Button = $VBoxContainer/Button2
@onready var button_3: Button = $VBoxContainer/Button3
@onready var button_4: Button = $VBoxContainer/Button4


func _ready():
    test_signal.connect(func(): print("test_signal"))
    test_signal2.connect(func(a): print("test_signal2:", a))
    test_signal3.connect(func(a, b): print("test_signal2:", a, b))
    test_signal4.connect(func(a, b, c): print("test_signal2:", a, b, c))

    button.pressed.connect(func(): test_signal.emit())
    button_2.pressed.connect(func(): test_signal2.emit(1))
    button_3.pressed.connect(func(): test_signal3.emit(1, 2))
    button_4.pressed.connect(func(): test_signal4.emit(1, 2, 3))

This code snippet can run without any error or warning. It seems that the signal object does not check the parameters when emit and connect. So, the argument list of signal is actually meaningless.
I think the number of parameters should at least be checked for correctness at compile time.

Steps to reproduce

see issue.

Minimal reproduction project (MRP)

signal-args.zip

@AThousandShips
Copy link
Member

Thank you for reporting, this is already tracked in:

We prefer to keep things in one place, so closing this

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants