summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2023-01-08 22:34:51 -0800
committerGitHub <noreply@github.com>2023-01-09 07:34:51 +0100
commitb68b28fd2448b15e989b9e8b07e33eee4f9b8822 (patch)
treec72b4c650e4c0de7ff28c008abe18e4520270865
parenta55604a3d8605e398f27df364cc215b7114395eb (diff)
downloadNim-b68b28fd2448b15e989b9e8b07e33eee4f9b8822.tar.gz
fix typeRel of typeDesc (#21227)
-rw-r--r--compiler/sigmatch.nim8
-rw-r--r--tests/typerel/tint.nim4
2 files changed, 10 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 75e3e5428..0dbd5e5f1 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1840,7 +1840,9 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
       elif f.base.kind == tyNone:
         result = isGeneric
       else:
-        result = typeRel(c, f.base, a.base, flags)
+        let r = typeRel(c, f.base, a.base, flags)
+        if r >= isIntConv:
+          result = r
 
       if result != isNone:
         put(c, f, a)
@@ -1848,7 +1850,9 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
       if tfUnresolved in f.flags:
         result = typeRel(c, prev.base, a, flags)
       elif a.kind == tyTypeDesc:
-        result = typeRel(c, prev.base, a.base, flags)
+        let r = typeRel(c, prev.base, a.base, flags)
+        if r >= isIntConv:
+          result = r
       else:
         result = isNone
 
diff --git a/tests/typerel/tint.nim b/tests/typerel/tint.nim
new file mode 100644
index 000000000..de0e78a81
--- /dev/null
+++ b/tests/typerel/tint.nim
@@ -0,0 +1,4 @@
+
+template a(T: type int32) = discard
+template a(T: type int64) = discard
+a(int)