Skip to content

parser: fix assigning static method to anon fn (fix #19484) - #19499

Merged
spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_assign_static_method
Oct 3, 2023
Merged

spytheman merged 1 commit into
vlang:masterfrom
yuyi98:fix_assign_static_method

Conversation

@yuyi98

@yuyi98 yuyi98 commented Oct 3, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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
@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