Godot version: v4.0.dev.custom_build 35ff38b3d
OS/device including version: windows 10
Issue description:
func f(p, ): ## <-- no errors
print(p)
func _ready():
f(0, ) ## <-- no error
When running with the GDScript test runner for this snippet, generates this output file:
Parser bug: invalid inheritance.
EDIT: seems to happen for all "valid" scripts though...
This may be done by design. Trailing commas in function declarations and calls make it possible to write more diff-friendly code:
# If we add one more argument, we have to modify only 1 line (1 addition).
hello(
"foo",
"bar",
"baz",
)
# If we add one more argument, we have to modify 2 lines (2 additions, 1 deletion).
hello(
"foo",
"bar",
"baz"
)
Many languages such as Python and JavaScript now allow this. Therefore, I would prefer this behavior to stay in :slightly_smiling_face:
Yes, this is intended. Many users asked for this so I added it.
I guess the problem comes from having this inline over multiple lines, but if that's difficult to solve then perhaps not worth it.
Most helpful comment
This may be done by design. Trailing commas in function declarations and calls make it possible to write more diff-friendly code:
Many languages such as Python and JavaScript now allow this. Therefore, I would prefer this behavior to stay in :slightly_smiling_face: