diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-07-07 15:25:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-07 15:25:25 +0200 |
commit | bab1f67971556f8cea4e1b082403165014e51135 (patch) | |
tree | 8b64b4a4c3884988c7e8da2554d0bf5dffd27299 | |
parent | 6a7f8e8ab5dddd3796c52b5f500cbc4c4b839b6a (diff) | |
download | Nim-bab1f67971556f8cea4e1b082403165014e51135.tar.gz |
fixes #11660 (#11677)
-rw-r--r-- | compiler/semtypinst.nim | 5 | ||||
-rw-r--r-- | tests/misc/tparamsindefault.nim | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 479f88bf0..af840e80c 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -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])) diff --git a/tests/misc/tparamsindefault.nim b/tests/misc/tparamsindefault.nim index c678dcc60..3fe917f2b 100644 --- a/tests/misc/tparamsindefault.nim +++ b/tests/misc/tparamsindefault.nim @@ -18,6 +18,7 @@ f3 10 15 25 true true false true world +typedescDefault ''' """ @@ -112,3 +113,8 @@ block: echo pySubstr("Hello world", -5) + +# bug #11660 + +func typedescDefault(T: typedesc; arg: T = 0) = debugEcho "typedescDefault" +typedescDefault(int) |