File: t5167_3.nim

package info (click to toggle)
nim 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,911,644 kB
  • sloc: sh: 24,603; ansic: 1,761; python: 1,492; makefile: 1,013; sql: 298; asm: 141; xml: 13
file content (25 lines) | stat: -rw-r--r-- 663 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
cmd: "nim c --threads:on $file"
errormsg: "type mismatch"
line: 24
"""

type
  TGeneric[T] = object
    x: int

proc foo1[A, B, C, D](x: proc (a: A, b: B, c: C, d: D)) =
  echo "foo1"

proc foo2(x: proc(x: int)) =
  echo "foo2"

# The goal of this test is to verify that none of the generic parameters of the
# proc will be marked as unused. The error message should be "type mismatch" instead
# of "'bar' doesn't have a concrete type, due to unspecified generic parameters".
proc bar[A, B, C, D](x: A, y: seq[B], z: array[4, TGeneric[C]], r: TGeneric[D]) =
  echo "bar"

foo1[int, seq[int], array[4, TGeneric[float]], TGeneric[string]] bar
foo2 bar