fixes regression: overloading by 'var'
This commit is contained in:
parent
d3fc6e1f28
commit
e40b667891
3 changed files with 140 additions and 131 deletions
|
|
@ -159,7 +159,7 @@ proc sumGeneric(t: PType): int =
|
||||||
inc result
|
inc result
|
||||||
inc isvar
|
inc isvar
|
||||||
of tyGenericInvocation, tyTuple:
|
of tyGenericInvocation, tyTuple:
|
||||||
result = ord(t.kind == tyGenericInvocation)
|
result += ord(t.kind == tyGenericInvocation)
|
||||||
for i in 0 .. <t.len: result += t.sons[i].sumGeneric
|
for i in 0 .. <t.len: result += t.sons[i].sumGeneric
|
||||||
break
|
break
|
||||||
of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break
|
of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break
|
||||||
|
|
@ -167,7 +167,8 @@ proc sumGeneric(t: PType): int =
|
||||||
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
||||||
tyUInt..tyUInt64:
|
tyUInt..tyUInt64:
|
||||||
return isvar
|
return isvar
|
||||||
else: return 0
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
#var ggDebug: bool
|
#var ggDebug: bool
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ ref T
|
||||||
2
|
2
|
||||||
1
|
1
|
||||||
@[123, 2, 1]
|
@[123, 2, 1]
|
||||||
Called!'''
|
Called!
|
||||||
|
merge with var
|
||||||
|
merge no var'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Things that's even in the spec now!
|
# Things that's even in the spec now!
|
||||||
|
|
@ -103,8 +105,14 @@ proc mget*[T](future: FutureVar[T]): var T =
|
||||||
proc reset*[T](future: FutureVar[T]) =
|
proc reset*[T](future: FutureVar[T]) =
|
||||||
echo "Called!"
|
echo "Called!"
|
||||||
|
|
||||||
|
proc merge[T](x: Future[T]) = echo "merge no var"
|
||||||
|
proc merge[T](x: var Future[T]) = echo "merge with var"
|
||||||
|
|
||||||
when true:
|
when true:
|
||||||
var foo = newFutureVar[string]()
|
var foo = newFutureVar[string]()
|
||||||
foo.mget() = ""
|
foo.mget() = ""
|
||||||
foo.mget.add("Foobar")
|
foo.mget.add("Foobar")
|
||||||
foo.reset()
|
foo.reset()
|
||||||
|
var bar = newFuture[int]()
|
||||||
|
bar.merge # merge with var
|
||||||
|
merge(newFuture[int]()) # merge no var
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue