tintypesection.nim 677 B

123456789101112131415161718192021222324252627282930313233
  1. # issues with concepts in type section types
  2. block: # issue #22839
  3. type
  4. Comparable = concept
  5. proc `<`(a, b: Self): bool
  6. # Works with this.
  7. # Comparable = concept a
  8. # `<`(a, a) is bool
  9. # Doesn't work with the new style concept.
  10. Node[T: Comparable] = object
  11. data: T
  12. next: ref Node[T]
  13. var x: Node[int]
  14. type NotComparable = object
  15. doAssert not (compiles do:
  16. var y: Node[NotComparable])
  17. proc `<`(a, b: NotComparable): bool = false
  18. var z: Node[NotComparable]
  19. block: # bug #24040
  20. type
  21. Xable = concept
  22. proc x(y: Self): int
  23. A[T: Xable] = tuple
  24. foo: T
  25. B[T: Xable] = object
  26. a: A[T]