Skip to content

Commit

Permalink
fixes #11660 (#11677)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Jul 7, 2019
1 parent 6a7f8e8 commit bab1f67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/semtypinst.nim
Expand Up @@ -539,7 +539,10 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
let lookup = cl.typeMap.lookup(t)
if lookup != nil:
result = lookup
if tfUnresolved in t.flags or cl.skipTypedesc: result = result.base
if result.kind != tyTypeDesc:
result = makeTypeDesc(cl.c, result)
elif tfUnresolved in t.flags or cl.skipTypedesc:
result = result.base
elif t.sons[0].kind != tyNone:
result = makeTypeDesc(cl.c, replaceTypeVarsT(cl, t.sons[0]))

Expand Down
6 changes: 6 additions & 0 deletions tests/misc/tparamsindefault.nim
Expand Up @@ -18,6 +18,7 @@ f3 10 15 25
true true
false true
world
typedescDefault
'''
"""

Expand Down Expand Up @@ -112,3 +113,8 @@ block:

echo pySubstr("Hello world", -5)


# bug #11660

func typedescDefault(T: typedesc; arg: T = 0) = debugEcho "typedescDefault"
typedescDefault(int)

0 comments on commit bab1f67

Please sign in to comment.