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

gdlint feature request: Checking enum variable assignment and operations #332

Open
heppocogne opened this issue Oct 6, 2024 · 0 comments
Labels
enhancement New feature or request linter

Comments

@heppocogne
Copy link

The enum type of GDScript behaves similarly to that of C/C++ language. That is, we can write some inappropriate operation which may lead bugs:

enum Example {
	VALUE_A,
	VALUE_B,
}

var example: Example
# CASE1: 10 is neither Example.VALUE_A nor Example.VALUE_B
example = 10
# explicit type conversion should be allowed
example = 20 as Examle

# CASE2: +, -, *, / operation usually gives meaningless result
var example2 = Example.VALUE_A + Example.VALUE_B
# use of &, |, ^ (and bit shift?) operator should be allowed
exmaple2 = Example.VALUE_A & Example.VALUE_B
@heppocogne heppocogne changed the title gdlint feature request: Checking enum variable assignment and gdlint feature request: Checking enum variable assignment and operations Oct 6, 2024
@Scony Scony added enhancement New feature or request linter labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linter
Projects
None yet
Development

No branches or pull requests

2 participants