t5167_3.nim 663 B

1234567891011121314151617181920212223242526
  1. discard """
  2. cmd: "nim c --threads:on $file"
  3. errormsg: "type mismatch"
  4. line: 24
  5. """
  6. type
  7. TGeneric[T] = object
  8. x: int
  9. proc foo1[A, B, C, D](x: proc (a: A, b: B, c: C, d: D)) =
  10. echo "foo1"
  11. proc foo2(x: proc(x: int)) =
  12. echo "foo2"
  13. # The goal of this test is to verify that none of the generic parameters of the
  14. # proc will be marked as unused. The error message should be "type mismatch" instead
  15. # of "'bar' doesn't have a concrete type, due to unspecified generic parameters".
  16. proc bar[A, B, C, D](x: A, y: seq[B], z: array[4, TGeneric[C]], r: TGeneric[D]) =
  17. echo "bar"
  18. foo1[int, seq[int], array[4, TGeneric[float]], TGeneric[string]] bar
  19. foo2 bar