tvarious.nim 1005 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. discard """
  2. action: compile
  3. """
  4. # Test various aspects
  5. # bug #572
  6. var a=12345678901'u64
  7. var x = (x: 42, y: (a: 8, z: 10))
  8. echo x.y
  9. import
  10. mvarious
  11. type
  12. PA = ref TA
  13. PB = ref TB
  14. TB = object
  15. a: PA
  16. TA = object
  17. b: TB
  18. x: int
  19. proc getPA(): PA =
  20. var
  21. b: bool
  22. b = not false
  23. return nil
  24. # bug #501
  25. proc f(): int = 54
  26. var
  27. global: int
  28. var
  29. s: string
  30. i: int
  31. r: TA
  32. r.b.a.x = 0
  33. global = global + 1
  34. exportme()
  35. write(stdout, "Hallo wie heißt du? ")
  36. write(stdout, getPA().x)
  37. s = readLine(stdin)
  38. i = 0
  39. while i < s.len:
  40. if s[i] == 'c': write(stdout, "'c' in deinem Namen gefunden\n")
  41. i = i + 1
  42. write(stdout, "Du heißt " & s)
  43. # bug #544
  44. # yay, fails again
  45. type Bar [T; I:range] = array[I, T]
  46. proc foo*[T; I:range](a, b: Bar[T, I]): Bar[T, I] =
  47. when len(a) != 3:
  48. # Error: constant expression expected
  49. {.fatal:"Dimensions have to be 3".}
  50. #...
  51. block:
  52. var a, b: Bar[int, range[0..2]]
  53. discard foo(a, b)
  54. # bug #1788
  55. echo "hello" & char(ord(' ')) & "world"