tcan.nim 653 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. discard """
  2. output: '''
  3. '''
  4. """
  5. # Created by Eric Doughty-Papassideris on 2011-02-16.
  6. block talias_generic:
  7. type
  8. TGen[T] = object
  9. TGen2[T] = TGen[T]
  10. block talias_specialised:
  11. type
  12. TGen[T] = object
  13. TSpef = TGen[string]
  14. var s: TSpef
  15. block tinherit:
  16. type
  17. TGen[T] = object of RootObj
  18. x, y: T
  19. TSpef[T] = object of TGen[T]
  20. var s: TSpef[float]
  21. s.x = 0.4
  22. s.y = 0.6
  23. block tspecialise:
  24. type
  25. TGen[T] {.inheritable.} = object
  26. TSpef = object of TGen[string]
  27. block tspecialised_equivalent:
  28. type
  29. TGen[T] = tuple[a: T]
  30. TSpef = tuple[a: string]
  31. var
  32. a: TGen[string]
  33. b: TSpef
  34. a = b