overload resolution for proc vars
This commit is contained in:
parent
36818817bd
commit
300430fbba
56 changed files with 2772 additions and 2430 deletions
|
|
@ -1,8 +1,8 @@
|
|||
# Test ambigious symbols
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, mambsym2
|
||||
|
||||
var
|
||||
v: TExport #ERROR_MSG ambigious identifier
|
||||
v: TExport #ERROR_MSG ambiguous identifier
|
||||
|
||||
v = y
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Test ambigious symbols
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, times
|
||||
|
||||
var
|
||||
v = mDec #ERROR_MSG ambigious identifier
|
||||
v = mDec #ERROR_MSG ambiguous identifier
|
||||
|
||||
writeln(stdout, ord(v))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Test ambigious symbols
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsys1, mambsys2
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,26 @@
|
|||
# Test the closure implementation
|
||||
|
||||
proc map(n: var openarray[int], fn: proc (x: int): int {.closure}) =
|
||||
for i in 0..n.len-1:
|
||||
n[i] = fn(n[i])
|
||||
for i in 0..n.len-1: n[i] = fn(n[i])
|
||||
|
||||
proc foldr(n: openarray[int], fn: proc (x, y: int): int {.closure}): int =
|
||||
result = 0
|
||||
for i in 0..n.len-1:
|
||||
result = fn(result, n[i])
|
||||
|
||||
var
|
||||
myData: array[0..9, int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
myData: array[0..4, int] = [0, 1, 2, 3, 4]
|
||||
|
||||
proc testA() =
|
||||
var p = 0
|
||||
map(myData, lambda (x: int): int =
|
||||
result = x + 1 shl (lambda (y: int): int =
|
||||
return y + 1
|
||||
return y + p
|
||||
)(0)
|
||||
inc(p), 88)
|
||||
inc(p))
|
||||
|
||||
testA()
|
||||
for x in items(myData):
|
||||
echo x
|
||||
write(stout, x)
|
||||
#OUT 2 4 6 8 10
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import
|
||||
unicode, cgi, terminal, libcurl, web,
|
||||
parsexml, parseopt, parsecfg,
|
||||
osproc, zipfiles,
|
||||
osproc,
|
||||
sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf,
|
||||
sdl_image, sdl_mixer_nosmpeg,
|
||||
cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi,
|
||||
|
|
@ -12,6 +12,10 @@ import
|
|||
cairowin32, cairoxlib,
|
||||
odbcsql,
|
||||
gl, glut, glu, glx, glext, wingl,
|
||||
zlib, lua, lualib, lauxlib, mysql, sqlite3, python, tcl
|
||||
lua, lualib, lauxlib, mysql, sqlite3, python, tcl
|
||||
|
||||
when defined(linux):
|
||||
import
|
||||
zlib, zipfiles
|
||||
|
||||
writeln(stdout, "test compilation of binding modules")
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression cannot be called
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue