diff --git a/compiler/vm.nim b/compiler/vm.nim index fe67f4d4c..2da242771 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1426,6 +1426,12 @@ proc evalMacroCall*(module: PSym, n, nOrig: PNode, sym: PSym): PNode = inc(evalMacroCounter) if evalMacroCounter > 100: globalError(n.info, errTemplateInstantiationTooNested) + + # immediate macros can bypass any type and arity checking so we check the + # arity here too: + if sym.typ.len > n.safeLen and sym.typ.len > 1: + globalError(n.info, "got $#, but expected $# argument(s)" % [$ = L + # return value: tos.slots[0].kind = rkNode tos.slots[0].node = newNodeIT(nkEmpty, n.info, sym.typ.sons[0]) diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 41b20cb35..a9a0b0fbe 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -419,12 +419,12 @@ when defined(windows) or defined(nimdoc): var acceptExPtr: pointer = nil var getAcceptExSockAddrsPtr: pointer = nil - proc initPointer(s: SocketHandle, func: var pointer, guid: var TGUID): bool = + proc initPointer(s: SocketHandle, fun: var pointer, guid: var TGUID): bool = # Ref: https://github.com/powdahound/twisted/blob/master/twisted/internet/iocpreactor/iocpsupport/winsock_pointers.c var bytesRet: Dword - func = nil + fun = nil result = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, addr guid, - sizeof(TGUID).Dword, addr func, sizeof(pointer).Dword, + sizeof(TGUID).Dword, addr fun, sizeof(pointer).Dword, addr bytesRet, nil, nil) == 0 proc initAll() = @@ -440,12 +440,12 @@ when defined(windows) or defined(nimdoc): lpSendBuffer: pointer, dwSendDataLength: Dword, lpdwBytesSent: PDword, lpOverlapped: POVERLAPPED): bool = if connectExPtr.isNil: raise newException(ValueError, "Need to initialise ConnectEx().") - let func = + let fun = cast[proc (s: SocketHandle, name: ptr TSockAddr, namelen: cint, lpSendBuffer: pointer, dwSendDataLength: Dword, lpdwBytesSent: PDword, lpOverlapped: POVERLAPPED): bool {.stdcall,gcsafe.}](connectExPtr) - result = func(s, name, namelen, lpSendBuffer, dwSendDataLength, lpdwBytesSent, + result = fun(s, name, namelen, lpSendBuffer, dwSendDataLength, lpdwBytesSent, lpOverlapped) proc acceptEx(listenSock, acceptSock: SocketHandle, lpOutputBuffer: pointer, @@ -453,12 +453,12 @@ when defined(windows) or defined(nimdoc): dwRemoteAddressLength: Dword, lpdwBytesReceived: PDword, lpOverlapped: POVERLAPPED): bool = if acceptExPtr.isNil: raise newException(ValueError, "Need to initialise AcceptEx().") - let func = + let fun = cast[proc (listenSock, acceptSock: SocketHandle, lpOutputBuffer: pointer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: Dword, lpdwBytesReceived: PDword, lpOverlapped: POVERLAPPED): bool {.stdcall,gcsafe.}](acceptExPtr) - result = func(listenSock, acceptSock, lpOutputBuffer, dwReceiveDataLength, + result = fun(listenSock, acceptSock, lpOutputBuffer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength, lpdwBytesReceived, lpOverlapped) @@ -469,14 +469,14 @@ when defined(windows) or defined(nimdoc): if getAcceptExSockAddrsPtr.isNil: raise newException(ValueError, "Need to initialise getAcceptExSockAddrs().") - let func = + let fun = cast[proc (lpOutputBuffer: pointer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: Dword, LocalSockaddr: ptr ptr TSockAddr, LocalSockaddrLength: LPInt, RemoteSockaddr: ptr ptr TSockAddr, RemoteSockaddrLength: LPInt) {.stdcall,gcsafe.}](getAcceptExSockAddrsPtr) - func(lpOutputBuffer, dwReceiveDataLength, dwLocalAddressLength, + fun(lpOutputBuffer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength, LocalSockaddr, LocalSockaddrLength, RemoteSockaddr, RemoteSockaddrLength) diff --git a/todo.txt b/todo.txt index d301acdc3..b0181b241 100644 --- a/todo.txt +++ b/todo.txt @@ -4,6 +4,11 @@ version 0.10 - document 'converter' - document the tables module better +- The bitwise 'not' operator will be renamed to 'bnot' to + prevent 'not 4 == 5' from compiling. -> requires 'mixin' annotation for procs! +- A named tuple will be compatible to a tuple with different names. +- The 'do' notation might be trimmed so that its only purpose is to pass + multiple multi line constructs to a macro. - c2nim depends on the compiler - make nimble part of the distribution diff --git a/web/news.txt b/web/news.txt index a8dee9c15..2c1700489 100644 --- a/web/news.txt +++ b/web/news.txt @@ -33,6 +33,13 @@ News - The ``using`` language feature now needs to be activated via the new ``{.experimental.}`` pragma that enables experimental language features. - Destructors are now officially *experimental*. + - Standalone ``except`` and ``finally`` statements are deprecated now. + The standalone ``finally`` can be replaced with ``defer``, + standalone ``except`` requires an explicit ``try``. + - Operators ending in ``>`` are considered as "arrow like" and have their + own priority level and are right associative. This means that + the ``=>`` and ``->`` operators from the `future `_ module + work better. Language Additions