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

function body { error message is not correct #16133

Open
ghost opened this issue Oct 21, 2022 · 2 comments
Open

function body { error message is not correct #16133

ghost opened this issue Oct 21, 2022 · 2 comments
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@ghost
Copy link

ghost commented Oct 21, 2022

V version: 0.3.1 51f4d99
OS: ArchLinux

What did you do?

fn foo()[
	println('')
]

What did you expect to see?
error like [ is invalid.

What did you see instead?

bug.v:2:2: error: fixed array size cannot use non-constant value
    1 | fn foo()[
    2 |     println('')
      |     ~~~~~~~~~~~
    3 | ]
@ghost ghost added the Bug This tag is applied to issues which reports bugs. label Oct 21, 2022
@ItsAshrafSyed
Copy link

can i fix this?

@felipensp
Copy link
Member

The message is not wrong at all, it is parsing a possible fixed array syntax which also is not allowed.

error: fixed array cannot be returned by function
    1 | const abc = 1
    2 |
    3 | fn foo()[abc]int {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants