tinvalidborrow.nim 563 B

1234567891011121314151617181920212223242526
  1. discard """
  2. cmd: "nim check --hints:off --warnings:off $file"
  3. action: "reject"
  4. nimout:'''
  5. tinvalidborrow.nim(18, 3) Error: only a 'distinct' type can borrow `.`
  6. tinvalidborrow.nim(19, 3) Error: only a 'distinct' type can borrow `.`
  7. tinvalidborrow.nim(20, 1) Error: no symbol to borrow from found
  8. '''
  9. """
  10. # bug #516
  11. type
  12. TAtom = culong
  13. Test {.borrow:`.`.} = distinct int
  14. Foo[T] = object
  15. a: int
  16. Bar[T] {.borrow:`.`.} = Foo[T]
  17. OtherFoo {.borrow:`.`.} = Foo[int]
  18. proc `==`*(a, b: TAtom): bool {.borrow.}
  19. var
  20. d, e: TAtom
  21. discard( $(d == e) )