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

shorthand enum value not allowed when pushing to channel #23244

Closed
islonely opened this issue Dec 23, 2024 · 0 comments · Fixed by #23247
Closed

shorthand enum value not allowed when pushing to channel #23244

islonely opened this issue Dec 23, 2024 · 0 comments · Fixed by #23247
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@islonely
Copy link
Contributor

islonely commented Dec 23, 2024

Describe the bug

chan <- .enum_val is not allowed. You must use chan <- SomeEnum.enum_val in order to push it.

Reproduction Steps

enum FooBar {
	foo
	bar
}

fn main() {
	ch := chan FooBar{cap: 10}
	ch <- .foo
	println(<-ch)
}

Expected Behavior

Code should push .foo to the channel instead of producing V error.

Current Behavior

/Users/adamoates/Documents/test.v:8:8: error: expected type is not an enum (`chan FooBar`)
    6 | fn main() {
    7 |     ch := chan FooBar{cap: 10}
    8 |     ch <- .foo
      |           ~~~~
    9 |     println(<-ch)
   10 | }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.9 2911f29.98f13ef

Environment details (OS name and version, etc.)

V full version: V 0.4.9 2911f29.98f13ef
OS: macos, macOS, 15.1.1, 24B91
Processor: 8 cpus, 64bit, little endian, Apple M3

getwd: /Users/adamoates/Documents/shattlebip
vexe: /Users/adamoates/v/v
vexe mtime: 2024-12-23 02:11:42

vroot: OK, value: /Users/adamoates/v
VMODULES: OK, value: /Users/adamoates/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.39.5 (Apple Git-154)
Git vroot status: 0.4.9-10-g98f13ef4
.git/config present: true

CC version: Apple clang version 16.0.0 (clang-1600.0.26.4)
emcc version: N/A
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

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.

Huly®: V_0.6-21678

@islonely islonely added the Bug This tag is applied to issues which reports bugs. label Dec 23, 2024
@yuyi98 yuyi98 self-assigned this Dec 23, 2024
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.

2 participants