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

parser: fix assigning with in another module sumtypes (fix #19413) #19414

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Sep 22, 2023

This PR fix assigning with in another module sumtypes (fix #19413).

  • Fix assigning with in another module sumtypes.
  • Add test.

aa/aa.v

module aa

pub type MySumType = S1 | S2

pub struct S1 {}

pub struct S2 {}

tt1.v

import aa

fn main() {
	node := aa.MySumType(aa.S1{})

	cond := node in [aa.S1, aa.S2]
	mut b := 'b'
	mut c := 'c'

	if cond {
		println('${cond} --- ${b} --- ${c}')
		assert '${cond} --- ${b} --- ${c}' == 'true --- b --- c'
	} else {
		assert false
	}
}

PS D:\Test\v\tt1> v run .
true --- b --- c

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.

Oof, very good find.

@spytheman spytheman merged commit 9929e95 into vlang:master Sep 22, 2023
46 checks passed
@yuyi98 yuyi98 deleted the fix_undefined_ident branch September 23, 2023 00:27
Wertzui123 pushed a commit to Wertzui123/v that referenced this pull request Oct 8, 2023
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.

Undefined ident: b when using mut b := '' after cond := node in [aa.S1, aa.S2]
2 participants