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

cgen: fix array sort with fn call parameter (fix #19220) #19221

Merged
merged 2 commits into from
Aug 26, 2023

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Aug 26, 2023

This PR fix array sort with fn call parameter (fix #19220).

  • Fix array sort with fn call parameter.
  • Add test.
struct Info {
mut:
	fields []string
}

fn main() {
	mut info := Info{
		fields: ['aaa(', 'b(']
	}
	info.fields.sort(a.before('(').len < b.before('(').len)
	println(info.fields)
	assert info.fields == ['b(', 'aaa(']
}

PS D:\Test\v\tt1> v run .
['b(', 'aaa(']

@spytheman spytheman merged commit adf10f8 into vlang:master Aug 26, 2023
48 checks passed
@yuyi98 yuyi98 deleted the fix_array_sort branch August 27, 2023 01:31
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.

.sort() cgen error when using .sort(a.before('(').len < b.before('(').len)
3 participants