diff options
author | shirleyquirk <31934565+shirleyquirk@users.noreply.github.com> | 2020-10-27 12:38:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 12:38:46 +0000 |
commit | 218acfe3671a5a4b7a4c203b6010fdacbe32051c (patch) | |
tree | e5eaf744040a27db8f41aecc13fdbd4a1df825d2 /lib/pure | |
parent | 12143d90c828bb4142751a6511ce790aac8aca51 (diff) | |
download | Nim-218acfe3671a5a4b7a4c203b6010fdacbe32051c.tar.gz |
fixes #10456,#12928 issues when chaining templates to sortedByIt (#15734)
* update c_malloc's to csize_t fix for broken --os:ios * I'm an idiot sorry * Create talgorithm.nim * workaround for #10456 I don't understand the intricacies of how lambdalifting and template expansions interact with lent, so i don't know how to fix the real problem, but this sidesteps whatever issue that is. * working test, use typeof rather than auto
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/algorithm.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index a277d1429..ff835b57a 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -501,7 +501,7 @@ template sortedByIt*(seq1, op: untyped): untyped = # Nested sort assert people.sortedByIt((it.age, it.name)) == @[(name: "p2", age: 20), (name: "p3", age: 30), (name: "p4", age: 30), (name: "p1", age: 60)] - var result = sorted(seq1, proc(x, y: typeof(seq1[0])): int = + var result = sorted(seq1, proc(x, y: typeof(items(seq1), typeOfIter)): int = var it {.inject.} = x let a = op it = y |