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

checker: dimension checking error when mut array is passed multiple times as args #20172

Closed
shove70 opened this issue Dec 14, 2023 · 1 comment · Fixed by #20173
Closed

checker: dimension checking error when mut array is passed multiple times as args #20172

shove70 opened this issue Dec 14, 2023 · 1 comment · Fixed by #20173
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@shove70
Copy link
Contributor

shove70 commented Dec 14, 2023

Describe the bug

fn foo(mut arr []int) {
	bar(mut arr)
}

fn bar(mut arr [][]int) {
}

fn main() {
	mut arr := [1, 2, 3]
	foo(mut arr)
}

Reproduction Steps

When it is non-mut, everything is normal

Expected Behavior

error:

error: cannot use `[]int` as `&[][]int` in argument 1 to `bar`

Current Behavior

compile passed.

Possible Solution

No response

Additional Information/Context

No response

V version

latest master

Environment details (OS name and version, etc.)

macos, linux

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@shove70 shove70 added the Bug This tag is applied to issues which reports bugs. label Dec 14, 2023
@shove70
Copy link
Contributor Author

shove70 commented Dec 14, 2023

fn foo(mut arr []int) {
	arr << 1
	bar(mut arr)
}

fn bar(mut arr [][]int) {
	println(arr)
}

fn main() {
	mut arr := [1, 2, 3]
	foo(mut arr)
}

run:

signal 11: segmentation fault
0   libsystem_platform.dylib            0x00007ff818e9637d _sigtramp + 29
1   ???                                 0x0000000000000000 0x0 + 0
2   a                                   0x000000010d2d6888 indent_Array_Array_int_str + 232
3   a                                   0x000000010d2d6244 Array_Array_int_str + 36
4   a                                   0x000000010d2d61f7 main__bar + 55
5   a                                   0x000000010d2d61b9 main__foo + 41
6   a                                   0x000000010d2d62ad main__main + 77
7   a                                   0x000000010d2d6667 main + 71
8   dyld                                0x00007ff818ae03a6 start + 1942

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

Successfully merging a pull request may close this issue.

1 participant