mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-04 13:04:44 +00:00
* fix #15836 proc arg return type auto unexpectly match proc with concrete type * fix #16244 * add test case for #12869
This commit is contained in:
14
tests/misc/t12869.nim
Normal file
14
tests/misc/t12869.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
errormsg: "type mismatch: got <bool> but expected 'int'"
|
||||
line: 12
|
||||
"""
|
||||
|
||||
import sugar
|
||||
from algorithm import sorted, SortOrder
|
||||
|
||||
let a = 5
|
||||
|
||||
proc sorted*[T](a: openArray[T], key: proc(v: T): int, order = SortOrder.Ascending): seq[T] =
|
||||
sorted(a, (x, y) => key(x) < key(y), order)
|
||||
|
||||
echo sorted(@[9, 1, 8, 2, 6, 4, 5, 0], (x) => (a - x).abs)
|
||||
9
tests/misc/t16244.nim
Normal file
9
tests/misc/t16244.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
errormsg: "type mismatch: got <int, float64>"
|
||||
line: 9
|
||||
"""
|
||||
|
||||
proc g(): auto = 1
|
||||
proc h(): auto = 1.0
|
||||
|
||||
var a = g() + h()
|
||||
Reference in New Issue
Block a user