summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2019-05-05 08:26:22 +0200
committerMiran <narimiran@disroot.org>2019-05-05 08:26:22 +0200
commit4fd79f5b47eb5aa3f9fcbd841a65360845019214 (patch)
tree70cb61a37abdb85cd7d8a392c5816fcd26396fc0
parent9348636cbab8f6ae2ae30345ab009b09f68098b9 (diff)
downloadNim-4fd79f5b47eb5aa3f9fcbd841a65360845019214.tar.gz
Fix #11058 (#11172)
-rw-r--r--compiler/semtypes.nim3
-rw-r--r--tests/metatype/tbindtypedesc.nim11
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 99fd62550..67f6a66db 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -950,7 +950,8 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
     if tfUnresolved notin paramType.flags:
       # naked typedescs are not bindOnce types
       if paramType.base.kind == tyNone and paramTypId != nil and
-          paramTypId.id == getIdent(c.cache, "typedesc").id:
+          (paramTypId.id == getIdent(c.cache, "typedesc").id or
+          paramTypId.id == getIdent(c.cache, "type").id):
         # XXX Why doesn't this check for tyTypeDesc instead?
         paramTypId = nil
       let t = c.newTypeWithSons(tyTypeDesc, @[paramType.base])
diff --git a/tests/metatype/tbindtypedesc.nim b/tests/metatype/tbindtypedesc.nim
index cfa80e581..d9f034432 100644
--- a/tests/metatype/tbindtypedesc.nim
+++ b/tests/metatype/tbindtypedesc.nim
@@ -82,3 +82,14 @@ reject bindArg(int, string, 10.0, 20, "test", "nest")
 reject bindArg(int, string, "test", "nest", 10, 20)
 
 echo "ok"
+
+#11058:
+template test(S: type, U: type) =
+  discard
+
+test(int, float)
+
+proc test2(S: type, U: type) =
+  discard
+
+test2(float, int)