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

Feature request: Suggestion to add missing parantheses when doing a switch over inline arrays #4374

Open
mtarik34b opened this issue Oct 13, 2024 · 0 comments

Comments

@mtarik34b
Copy link
Contributor

Switching over an inline array doesn't work without parantheses. It would be nice to have a suggestion for the case one forgets adding them.

package suggestion

main :: proc() {
	b0, b1: bool

	// doesn't work without parantheses
	switch [2]bool{b0, b1} {
		case {false, false}:
		case {false, true}:
		case {true, false}:
		case {true, true}:
	}

	// works thanks to parantheses
	switch ([2]bool{b0, b1}) {
		case {false, false}:
		case {false, true}:
		case {true, false}:
		case {true, true}:
	}
}

// Odin version:    dev-2024-10:55ff1769d
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

No branches or pull requests

1 participant