bugfix: implicit items/pairs work better

This commit is contained in:
Araq 2012-11-28 08:03:25 +01:00
commit 9483606d5b
3 changed files with 16 additions and 4 deletions

View file

@ -589,9 +589,10 @@ proc semStaticExpr(c: PContext, n: PNode): PNode =
proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode,
flags: TExprFlags): PNode = flags: TExprFlags): PNode =
if efWantIterator in flags: if flags*{efInTypeOf, efWantIterator} != {}:
result = semOverloadedCall(c, n, nOrig, {skIterator}) # consider: 'for x in pReturningArray()' --> we don't want the restriction
elif efInTypeOf in flags: # to 'skIterator' anymore; skIterator is preferred in sigmatch already for
# typeof support.
# for ``type(countup(1,3))``, see ``tests/ttoseq``. # for ``type(countup(1,3))``, see ``tests/ttoseq``.
result = semOverloadedCall(c, n, nOrig, result = semOverloadedCall(c, n, nOrig,
{skProc, skMethod, skConverter, skMacro, skTemplate, skIterator}) {skProc, skMethod, skConverter, skMacro, skTemplate, skIterator})

View file

@ -0,0 +1,12 @@
proc p(a, b: int, c: proc ()) =
c()
p(1, 3):
echo 1
echo 3
p(1, 1, proc() =
echo 1
echo 2)

View file

@ -82,7 +82,6 @@ version 0.9.XX
Not essential for 1.0.0 Not essential for 1.0.0
======================= =======================
- investigate the implicit items/pairs issue
- optimize method dispatchers - optimize method dispatchers
- ``with proc `+`(x, y: T): T`` for generic code - ``with proc `+`(x, y: T): T`` for generic code
- new feature: ``distinct T with operations`` - new feature: ``distinct T with operations``