summary refs log tree commit diff stats
path: root/tests/generics
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-10-11 17:42:49 +0800
committerGitHub <noreply@github.com>2022-10-11 11:42:49 +0200
commit083ea8f10cb27834cc9c22ba496de7a378f3c301 (patch)
tree4913455e2df4901524783bfa903d1722524ca5d7 /tests/generics
parent5602183234f59ece4fd668915da848f0753cbbb9 (diff)
downloadNim-083ea8f10cb27834cc9c22ba496de7a378f3c301.tar.gz
fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' (#20522)
* fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural'

* try fix
Diffstat (limited to 'tests/generics')
-rw-r--r--tests/generics/t7446.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/generics/t7446.nim b/tests/generics/t7446.nim
new file mode 100644
index 000000000..71aa8f0e8
--- /dev/null
+++ b/tests/generics/t7446.nim
@@ -0,0 +1,10 @@
+proc foo(x: Natural or SomeUnsignedInt):int = 
+  when x is int:
+    result = 1
+  else:
+    result = 2
+let a = 10
+doAssert foo(a) == 1
+
+let b = 10'u8
+doAssert foo(b) == 2
\ No newline at end of file