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

Imprecise error when attempting to use #reverse #unroll with a numeric range #4435

Open
Barinzaya opened this issue Oct 30, 2024 · 2 comments

Comments

@Barinzaya
Copy link
Contributor

Barinzaya commented Oct 30, 2024

Context

  • Operating System & Odin Version:
	Odin:    dev-2024-10-nightly
	OS:      EndeavourOS, Linux 6.11.5-arch1-1
	CPU:     AMD Ryzen 9 9950X 16-Core Processor
	RAM:     61888 MiB
	Backend: LLVM 18.1.6

Expected Behavior

When attempting to use #reverse #unroll on a loop with a numeric range, the specific error message for #reverse not being supported with ranges should be produced.

Error: #reverse for is not supported with ranges, prefer an explicit for loop with init, condition, and post arguments
        #reverse #unroll for i in 0..<10 { ...
                         ^~~~~~~~~~~~~~~~~ ...

Current Behavior

When attempting to use #reverse #unroll on a loop with a numeric range, the error message indicates that #reverse may only be used on a for in statement, despite apparently preceding one (albeit with an additional #unroll tag).

Syntax Error: #reverse can only be applied to a 'for in' statement
        #reverse #unroll for i in 0..<10 {
        ^

Steps to Reproduce

Attempt to build the following code:

package mre

import "core:fmt"

main :: proc() {
	#reverse #unroll for i in 0..<10 {
		fmt.println(i)
	}
}
@gingerBill
Copy link
Member

#unroll is still kind of a placeholder feature that shouldn't really be used.

@Barinzaya
Copy link
Contributor Author

Is there a permanent alternative planned, aside from hand-unrolling?

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