tsigmatch2.nim 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. discard """
  2. cmd: "nim check --showAllMismatches:on --hints:off $file"
  3. nimout: '''
  4. tsigmatch2.nim(40, 14) Error: type mismatch: got <float64>
  5. but expected one of:
  6. proc foo(args: varargs[string, myproc]): string
  7. first type mismatch at position: 1
  8. required type for args: varargs[string]
  9. but expression '1.2' is of type: float64
  10. proc foo(i: Foo): string
  11. first type mismatch at position: 1
  12. required type for i: Foo
  13. but expression '1.2' is of type: float64
  14. expression: foo(1.2)
  15. tsigmatch2.nim(40, 14) Error: expression '' has no type (or is ambiguous)
  16. tsigmatch2.nim(46, 3) Error: type mismatch: got <int literal(1)>
  17. but expected one of:
  18. proc foo(args: varargs[string, myproc])
  19. first type mismatch at position: 1
  20. required type for args: varargs[string]
  21. but expression '1' is of type: int literal(1)
  22. expression: foo 1
  23. '''
  24. errormsg: "type mismatch"
  25. """
  26. # line 30
  27. type Foo = object
  28. block: # issue #13182
  29. proc myproc(a: int): string = $("myproc", a)
  30. proc foo(args: varargs[string, myproc]): string = $args
  31. proc foo(i: Foo): string = "in foo(i)"
  32. static: doAssert foo(Foo()) == "in foo(i)"
  33. static: doAssert foo(1) == """["(\"myproc\", 1)"]"""
  34. doAssert not compiles(foo(1.2))
  35. discard foo(1.2)
  36. block:
  37. proc myproc[T](x: T): string =
  38. let temp = 12.isNil
  39. proc foo(args: varargs[string, myproc]) = discard
  40. foo 1
  41. static: echo "done"