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

Adds a warning when assigning a value in a conditional #1596

Merged
merged 2 commits into from
Jan 1, 2024

Conversation

Zonespace27
Copy link
Contributor

When assigning a value in an if() or switch() statement, the compiler will emit an AssignmentInConditional warning.

Closes #576

@ike709
Copy link
Collaborator

ike709 commented Dec 31, 2023

Wixoa may disagree but I think this should go with the 2000s warning codes since this emission can point out actual logic errors and isn't purely a stylistic choice.

@wixoaGit
Copy link
Member

wixoaGit commented Jan 1, 2024

Wixoa may disagree but I think this should go with the 2000s warning codes since this emission can point out actual logic errors and isn't purely a stylistic choice.

So is SuspiciousSwitchCase but that's also a 3000.

Though I am struggling to come up with a distinction between these two ranges. The 2000s are "for compiler configuration of actual behaviour" but this behavior seems to just be error/not error? Not much different from any of the other configurable warning codes.

@Zonespace27 Zonespace27 requested a review from wixoaGit January 1, 2024 07:39
@wixoaGit wixoaGit enabled auto-merge (squash) January 1, 2024 21:14
@wixoaGit wixoaGit merged commit fa34287 into OpenDreamProject:master Jan 1, 2024
6 checks passed
@Zonespace27 Zonespace27 deleted the conditional-warn branch January 1, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a warning for doing assignment in a conditional
3 participants