timports.nim 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. discard """
  2. output: '''
  3. 317
  4. TEST2
  5. 5 5 5
  6. false
  7. '''
  8. """
  9. import mbind_bracket, mclosed_sym, mdotlookup, mmodule_same_as_proc, mtypenodes
  10. block tbind_bracket:
  11. # bug #2599
  12. # also test that `[]` can be passed now as a first class construct:
  13. template takeBracket(x, a, i: untyped) =
  14. echo x(a, i)
  15. var a: array[10, int]
  16. a[8] = 317
  17. takeBracket(`[]`, a, 8)
  18. let reg = newRegistry[UUIDObject]()
  19. reg.register(UUIDObject())
  20. block tclosed_sym:
  21. # bug #2664
  22. proc same(r:R, d:int) = echo "TEST1"
  23. doIt(Data[int](d:123), R())
  24. import strutils, unicode # ambiguous `strip`
  25. block tdotlookup:
  26. foo(7)
  27. # bug #1444
  28. fn(4)
  29. doAssert doStrip(123) == "123"
  30. # bug #14254
  31. doAssert baz2[float](1'i8) == 1
  32. # bug #21883
  33. proc abc[T: not not int](x: T): T =
  34. var x = x
  35. x.set("hello", "world")
  36. result = x
  37. doAssert abc(5) == 10
  38. block: # ensure normal call is consistent with dot call
  39. proc T(x: int): float = x.float
  40. proc foo[T](x: int) =
  41. doAssert typeof(T(x)) is typeof(x.T)
  42. foo[uint](123)
  43. block tmodule_same_as_proc:
  44. # bug #1965
  45. proc test[T](t: T) =
  46. mmodule_same_as_proc"a"
  47. test(0)
  48. block ttypenodes:
  49. # issue #22699
  50. doAssert chop[bool](42) == 42