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 static method to anon fn (fix #19484) #19499

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Oct 3, 2023

This PR fix assigning static method to anon fn (fix #19484).

  • Fix assigning static method to anon fn.
  • Add test.
struct Foo {
}

fn Foo.bar() string {
	println('bar')
	return 'bar'
}

fn main() {
	anon_fn := Foo.bar
	ret := anon_fn()
	assert ret == 'bar'
}

PS D:\Test\v\tt1> v run .
bar

@spytheman
Copy link
Member

Excellent work.

@spytheman spytheman added the Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). label Oct 3, 2023
@spytheman spytheman merged commit 0904a9e into vlang:master Oct 3, 2023
45 of 46 checks passed
@yuyi98 yuyi98 deleted the fix_assign_static_method branch October 4, 2023 01:00
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
Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"expected type is not an enum" when assigning static method to anonymous function
2 participants