tintypesection.nim 525 B

1234567891011121314151617181920212223
  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]