parent
491162d3c8
commit
9c6fe59b55
2 changed files with 29 additions and 1 deletions
|
|
@ -204,7 +204,9 @@ proc sumGeneric(t: PType): int =
|
||||||
if t.sons[i] != nil:
|
if t.sons[i] != nil:
|
||||||
result += t.sons[i].sumGeneric
|
result += t.sons[i].sumGeneric
|
||||||
break
|
break
|
||||||
of tyGenericParam, tyExpr, tyStatic, tyStmt: break
|
of tyStatic:
|
||||||
|
return t.sons[0].sumGeneric + 1
|
||||||
|
of tyGenericParam, tyExpr, tyStmt: break
|
||||||
of tyAlias: t = t.lastSon
|
of tyAlias: t = t.lastSon
|
||||||
of tyBool, tyChar, tyEnum, tyObject, tyPointer,
|
of tyBool, tyChar, tyEnum, tyObject, tyPointer,
|
||||||
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
||||||
|
|
|
||||||
26
tests/overload/tstaticoverload.nim
Normal file
26
tests/overload/tstaticoverload.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
discard """
|
||||||
|
output: '''
|
||||||
|
dynamic: let
|
||||||
|
dynamic: var
|
||||||
|
static: const
|
||||||
|
static: literal
|
||||||
|
static: constant folding
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc foo(s: string) =
|
||||||
|
echo "dynamic: ", s
|
||||||
|
|
||||||
|
proc foo(s: static[string]) =
|
||||||
|
echo "static: ", s
|
||||||
|
|
||||||
|
let l = "let"
|
||||||
|
let v = "var"
|
||||||
|
const c = "const"
|
||||||
|
|
||||||
|
foo(l)
|
||||||
|
foo(v)
|
||||||
|
foo(c)
|
||||||
|
foo("literal")
|
||||||
|
foo("constant" & " " & "folding")
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue