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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
}