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

Incorrect warning about default value shows up for enum function parameters #94634

Closed
aaronfranke opened this issue Jul 22, 2024 · 0 comments · Fixed by #94635
Closed

Incorrect warning about default value shows up for enum function parameters #94634

aaronfranke opened this issue Jul 22, 2024 · 0 comments · Fixed by #94635

Comments

@aaronfranke
Copy link
Member

Tested versions

  • Reproducible in latest master as of writing 4e5ed0b
  • Reproducible in 4.3 beta 1.
  • Reproducible in 4.3 dev 6.
  • Does not occur in 4.3 dev 5.
  • Does not occur in 4.3 dev 3.
  • Does not occur in Godot 4.2 stable.

System information

macOS 14.5

Issue description

Line (ENUM_VARIABLE_WITHOUT_DEFAULT):
The variable "test" has an enum type and does not set an explicit default value. The default will be set to "0".

This error message shows up when using an enum in a function parameter. However, this warning is incorrect. The variable test is in fact not an ordinary variable, it is a parameter. And parameters do not have implicit default values. Values are either required (in which case it's provided by the caller) or optional (which have explicit default values).

Screenshot 2024-07-22 at 10 59 22 AM

Steps to reproduce

Put this code in a GDScript file:

enum Test {
	A = 1,
	B = 2,
}

func bugged(test: Test):
	print(test)

Minimal reproduction project (MRP)

enum-parameter-default-bug.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not Critical
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants