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: check shared variables types (fix #23313) #23316

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Dec 30, 2024

This PR check shared variables types (fix #23313, fix #23314)

  • Check shared variables types.
  • Add test.
enum Foo {
	zero
	one
}

fn main() {
	shared foo := Foo.one
	rlock foo {
		match foo {
			.zero { println('0000') }
			.one { println('1111') }
		}
	}
}

PS D:\Test\v\tt1> v run .
tt1.v:7:16: error: shared variables must be structs, arrays or maps
    5 | 
    6 | fn main() {
    7 |     shared foo := Foo.one
      |                   ~~~~~~~
    8 |     rlock foo {
    9 |         match foo {

Huly®: V_0.6-21748

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you.

@spytheman spytheman merged commit fb528cd into vlang:master Dec 30, 2024
72 checks passed
@yuyi98 yuyi98 deleted the check_shared_var_type branch December 31, 2024 00:56
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

Successfully merging this pull request may close these issues.

match *enum {...} produces C error match enum {...} not allowed with shared enum variable
2 participants