summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/concepts/tconcepts_issues.nim2
-rw-r--r--tests/errmsgs/t16654.nim2
-rw-r--r--tests/misc/t12869.nim2
-rw-r--r--tests/proc/tinferlambdareturn.nim36
-rw-r--r--tests/stdlib/tsugar.nim3
-rw-r--r--tests/types/t15836.nim2
-rw-r--r--tests/types/t15836_2.nim5
7 files changed, 42 insertions, 10 deletions
diff --git a/tests/concepts/tconcepts_issues.nim b/tests/concepts/tconcepts_issues.nim
index 1d5e415dd..d6c8674fd 100644
--- a/tests/concepts/tconcepts_issues.nim
+++ b/tests/concepts/tconcepts_issues.nim
@@ -510,7 +510,7 @@ proc depthOf*[V](orderType: typedesc[BreadthOrder], tree: AnyTree[V], root, goal
   if root == goal:
     return 0
   var order = init[LevelNode[V]](orderType)
-  order.expand(tree, root, (leaf) => (1, leaf))
+  order.expand(tree, root, (leaf) => (1.uint, leaf))
   while order.hasNext():
     let depthNode: LevelNode[V] = order.popNext()
     if depthNode.node == goal:
diff --git a/tests/errmsgs/t16654.nim b/tests/errmsgs/t16654.nim
index 749707c06..b2b57619b 100644
--- a/tests/errmsgs/t16654.nim
+++ b/tests/errmsgs/t16654.nim
@@ -1,6 +1,6 @@
 discard """
   cmd: "nim check $options $file"
-  errormsg: "type mismatch: got <int> but expected 'float'"
+  errormsg: "type mismatch: got <int literal(1), proc (r: GenericParam): auto>"
 """
 
 when true: # bug #16654
diff --git a/tests/misc/t12869.nim b/tests/misc/t12869.nim
index 731a4e95e..054e28a03 100644
--- a/tests/misc/t12869.nim
+++ b/tests/misc/t12869.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "type mismatch: got <bool> but expected 'int'"
+  errormsg: "type mismatch: got <openArray[int], proc (x: GenericParam, y: GenericParam): auto, SortOrder>"
   line: 12
 """
 
diff --git a/tests/proc/tinferlambdareturn.nim b/tests/proc/tinferlambdareturn.nim
new file mode 100644
index 000000000..e9e592871
--- /dev/null
+++ b/tests/proc/tinferlambdareturn.nim
@@ -0,0 +1,36 @@
+import std/[sugar, sequtils]
+
+block: # issue #23200
+  proc dosomething(iter: int -> (iterator: int)) =
+    discard
+  proc dosomething(iter: int -> seq[int]) =
+    discard
+  proc makeSeq(x: int): seq[int] =
+    @[x]
+  # Works fine with 1.6.12 and 1.6.14
+  dosomething(makeSeq)
+  # Works with 1.6.12, fails with 1.6.14
+  dosomething((y) => makeSeq(y))
+  dosomething(proc (y: auto): auto = makeSeq(y))
+  proc foo(y: auto): auto = makeSeq(y)
+  dosomething(foo)
+
+block: # issue #18866
+  proc somefn[T](list: openarray[T], op: proc (v: T): float) =
+    discard op(list[0])
+
+  type TimeD = object
+    year:  Natural
+    month: 1..12
+    day:   1..31
+
+  doAssert not compiles(@[TimeD()].somefn(proc (v: auto): auto =
+    v
+  ))
+  @[TimeD()].somefn(proc (v: auto): auto =
+    v.year.float
+  )
+  proc foo(v: auto): auto = v
+  doAssert not compiles(@[TimeD()].somefn(foo))
+  proc bar(v: auto): auto = v.year.float
+  @[TimeD()].somefn(bar)
diff --git a/tests/stdlib/tsugar.nim b/tests/stdlib/tsugar.nim
index b9cbdd3e3..2ea96cfbb 100644
--- a/tests/stdlib/tsugar.nim
+++ b/tests/stdlib/tsugar.nim
@@ -295,7 +295,8 @@ template main() =
       for i in 0..5:
         xs.add(i)
 
-      xs.apply(d => ys.add(d))
+      xs.apply(proc (d: auto) = ys.add(d))
+      # ^ can be turned into d => ys.add(d) when we can infer void return type, #16906
       doAssert ys == @[0, 1, 2, 3, 4, 5]
 
     test()
diff --git a/tests/types/t15836.nim b/tests/types/t15836.nim
index 9c0c26dec..27d3ad0d0 100644
--- a/tests/types/t15836.nim
+++ b/tests/types/t15836.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "type mismatch: got <string> but expected 'int'"
+  errormsg: "type mismatch: got <int literal(1), proc (a: GenericParam): auto>"
   line: 11
 """ 
 
diff --git a/tests/types/t15836_2.nim b/tests/types/t15836_2.nim
index 9afef416a..6a16e2d22 100644
--- a/tests/types/t15836_2.nim
+++ b/tests/types/t15836_2.nim
@@ -1,8 +1,3 @@
-
-discard """
-  action: "compile"
-  disabled: true
-"""
 import std/sugar
 
 type Tensor[T] = object