summary refs log tree commit diff stats
path: root/tests/overload/toverl2.nim
blob: ea0249e9fe8dc3501cb11e195043363516480b04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
discard """
  file: "toverl2.nim"
  output: "true012innertrue"
"""
# Test new overloading resolution rules

import strutils

proc toverl2(x: int): string = return $x
proc toverl2(x: bool): string = return $x

iterator toverl2(x: int): int = 
  var res = 0
  while res < x: 
    yield res
    inc(res)

var
  pp: proc (x: bool): string {.nimcall.} = toverl2

stdout.write(pp(true))

for x in toverl2(3): 
  stdout.write(toverl2(x))

block:
  proc toverl2(x: int): string = return "inner"
  stdout.write(toverl2(5))
  stdout.write(true)

stdout.write("\n")
#OUT true012innertrue