mdotlookup.nim 485 B

1234567891011121314151617181920212223242526272829
  1. proc baz(o: auto): int = 5 # if bar is exported, it works
  2. type MyObj = object
  3. x: int
  4. proc foo*(b: auto) =
  5. var o: MyObj
  6. echo b.baz, " ", o.x.baz, " ", b.baz()
  7. import sets
  8. var intset = initHashSet[int]()
  9. proc fn*[T](a: T) =
  10. if a in intset: echo("true")
  11. else: echo("false")
  12. import strutils
  13. proc doStrip*[T](a: T): string =
  14. result = ($a).strip()
  15. type Foo = int32
  16. proc baz2*[T](y: int): auto =
  17. result = y.Foo
  18. proc set*(x: var int, a, b: string) =
  19. x = a.len + b.len