1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix several sort declarations (#10919)

This commit is contained in:
Daniel Däschle
2021-07-23 07:55:55 +02:00
committed by GitHub
parent a2de3ffcdb
commit 091ce6cc08
3 changed files with 25 additions and 1 deletions

View File

@ -65,3 +65,20 @@ fn test_sorting_u64s() {
eprintln(' a: $a')
assert a == [u64(9), 8, 3, 2, 1, 0]
}
struct User {
age int
name string
}
fn g(mut users []User) {
users.sort(a.name > b.name)
}
fn f(mut users []User) {
users.sort(a.name < b.name)
}
fn z(mut users []User) {
users.sort(a.name < b.name)
}