t13426.nim 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. discard """
  2. cmd: "nim check --hints:off $file"
  3. errormsg: ""
  4. nimout: '''
  5. t13426.nim(81, 6) template/generic instantiation of `fun` from here
  6. t13426.nim(80, 24) Error: type mismatch: got <int> but expected 'string'
  7. t13426.nim(81, 6) template/generic instantiation of `fun` from here
  8. t13426.nim(80, 17) Error: type mismatch: got <uint, string>
  9. but expected one of:
  10. proc `and`(x, y: uint): uint
  11. first type mismatch at position: 2
  12. required type for y: uint
  13. but expression 'high(@[1])' is of type: string
  14. proc `and`(x, y: uint64): uint64
  15. first type mismatch at position: 2
  16. required type for y: uint64
  17. but expression 'high(@[1])' is of type: string
  18. 10 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
  19. expression: 1'u and high(@[1])
  20. t13426.nim(81, 6) template/generic instantiation of `fun` from here
  21. t13426.nim(80, 17) Error: expression '' has no type (or is ambiguous)
  22. t13426.nim(87, 6) template/generic instantiation of `fun` from here
  23. t13426.nim(86, 22) Error: type mismatch: got <int> but expected 'string'
  24. t13426.nim(87, 6) template/generic instantiation of `fun` from here
  25. t13426.nim(86, 15) Error: type mismatch: got <int literal(1), string>
  26. but expected one of:
  27. proc `and`(x, y: int): int
  28. first type mismatch at position: 2
  29. required type for y: int
  30. but expression 'high(@[1])' is of type: string
  31. proc `and`(x, y: int16): int16
  32. first type mismatch at position: 2
  33. required type for y: int16
  34. but expression 'high(@[1])' is of type: string
  35. proc `and`(x, y: int32): int32
  36. first type mismatch at position: 2
  37. required type for y: int32
  38. but expression 'high(@[1])' is of type: string
  39. proc `and`(x, y: int64): int64
  40. first type mismatch at position: 2
  41. required type for y: int64
  42. but expression 'high(@[1])' is of type: string
  43. proc `and`(x, y: int8): int8
  44. first type mismatch at position: 2
  45. required type for y: int8
  46. but expression 'high(@[1])' is of type: string
  47. proc `and`(x, y: uint): uint
  48. first type mismatch at position: 2
  49. required type for y: uint
  50. but expression 'high(@[1])' is of type: string
  51. proc `and`(x, y: uint16): uint16
  52. first type mismatch at position: 2
  53. required type for y: uint16
  54. but expression 'high(@[1])' is of type: string
  55. proc `and`(x, y: uint32): uint32
  56. first type mismatch at position: 2
  57. required type for y: uint32
  58. but expression 'high(@[1])' is of type: string
  59. proc `and`(x, y: uint64): uint64
  60. first type mismatch at position: 2
  61. required type for y: uint64
  62. but expression 'high(@[1])' is of type: string
  63. proc `and`(x, y: uint8): uint8
  64. first type mismatch at position: 2
  65. required type for y: uint8
  66. but expression 'high(@[1])' is of type: string
  67. 2 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
  68. expression: 1 and high(@[1])
  69. t13426.nim(87, 6) template/generic instantiation of `fun` from here
  70. t13426.nim(86, 15) Error: expression '' has no type (or is ambiguous)
  71. '''
  72. """
  73. # bug # #13426
  74. block:
  75. template bar(t): string = high(t)
  76. proc fun[A](key: A) =
  77. var h = 1'u and bar(@[1])
  78. fun(0)
  79. block:
  80. template bar(t): string = high(t)
  81. proc fun[A](key: A) =
  82. var h = 1 and bar(@[1])
  83. fun(0)