diff options
Diffstat (limited to 'tests/generics/mdotlookup.nim')
-rw-r--r-- | tests/generics/mdotlookup.nim | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/generics/mdotlookup.nim b/tests/generics/mdotlookup.nim index 2984574c2..090b97771 100644 --- a/tests/generics/mdotlookup.nim +++ b/tests/generics/mdotlookup.nim @@ -1,16 +1,28 @@ -proc baz(o: any): int = 5 # if bar is exported, it works +proc baz(o: auto): int = 5 # if bar is exported, it works type MyObj = object x: int -proc foo*(b: any) = +proc foo*(b: auto) = var o: MyObj echo b.baz, " ", o.x.baz, " ", b.baz() import sets -var intset = initSet[int]() +var intset = initHashSet[int]() proc fn*[T](a: T) = if a in intset: echo("true") else: echo("false") + +import strutils + +proc doStrip*[T](a: T): string = + result = ($a).strip() + +type Foo = int32 +proc baz2*[T](y: int): auto = + result = y.Foo + +proc set*(x: var int, a, b: string) = + x = a.len + b.len |