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

Compiler error: #unroll for &ref in slice #3351

Closed
thetarnav opened this issue Mar 29, 2024 · 1 comment
Closed

Compiler error: #unroll for &ref in slice #3351

thetarnav opened this issue Mar 29, 2024 · 1 comment

Comments

@thetarnav
Copy link
Contributor

Example:

package bug

main :: proc() {
	bools := make([]bool, 24)

	#unroll for i in 0..<6 {
		bools[i] = true
	}

	#unroll for _, i in bools[:6] {
		bools[i] = true
	}

	#unroll for &done in bools[:6] {  // Error here
		done = true
	}

	for i in 0..<6 {
		bools[i] = true
	}

	for _, i in bools[:6] {
		bools[i] = true
	}

	for &done in bools[:6] {
		done = true
	}
}

Odin check output:

/bug.odin(14:14) Syntax Error: Expected 'identifier', got '&'
	#unroll for &done in bools[:6] {
	            ^
/bug.odin(14:15) Syntax Error: Expected 'in', got 'identifier'
	#unroll for &done in bools[:6] {
	             ^
/bug.odin(14:20) Syntax Error: Expected an operand
	#unroll for &done in bools[:6] {
	                  ^
/bug.odin(15:14) Syntax Error: Expected '{', got 'newline'
	}

	for i in 0..<6 {
		bools[i] = true
	}

	for _, i in bools[:6 ...
	^

Report:

	Odin:    dev-2024-03:8899f4247
	OS:      Ubuntu 22.04.4 LTS, Linux 6.5.0-26-generic
	CPU:     Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
	RAM:     7631 MiB
	Backend: LLVM 17.0.6
@gingerBill
Copy link
Member

#unroll is mostly a placeholder for the future, so I don't really recommend using it yet.

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

2 participants