ttypeexprs.nim 612 B

1234567891011121314151617181920212223242526
  1. proc foo[T: ptr int | ptr string](x: T) = discard
  2. var x = "abc"
  3. foo(addr x)
  4. let n = 3'u32
  5. type Double = (
  6. when n.sizeof == 4: uint64
  7. elif n.sizeof == 2: uint32
  8. else: uint16
  9. )
  10. type
  11. A = (ref | ptr | pointer)
  12. B = pointer | ptr | ref
  13. C = ref | ptr | pointer
  14. template `+`(a, b): untyped = (b, a)
  15. template `*`(a, b): untyped = (a, b)
  16. doAssert (ref int + ref float * ref string + ref bool) is
  17. (ref bool, ((ref float, ref string), ref int))
  18. type X = ref int + ref float * ref string + ref bool
  19. doAssert X is (ref bool, ((ref float, ref string), ref int))
  20. type SomePointer = proc | ref | ptr | pointer