tconcisetypemismatch.nim 609 B

123456789101112131415161718192021222324
  1. discard """
  2. cmd: "nim c --hints:off -d:testsConciseTypeMismatch $file"
  3. errormsg: "type mismatch"
  4. nimout: '''
  5. tconcisetypemismatch.nim(23, 47) Error: type mismatch
  6. Expression: int(inNanoseconds(t2 - t1)) / 100.5
  7. [1] int(inNanoseconds(t2 - t1)): int
  8. [2] 100.5: float64
  9. Expected one of (first mismatch at [position]):
  10. [1] proc `/`(x, y: float): float
  11. [1] proc `/`(x, y: float32): float32
  12. [2] proc `/`(x, y: int): float
  13. '''
  14. """
  15. import std/monotimes
  16. from times import inNanoseconds
  17. let t1 = getMonotime()
  18. let result = 1 + 2
  19. let t2 = getMonotime()
  20. echo "Elapsed: ", (t2 - t1).inNanoseconds.int / 100.5