From 083ea8f10cb27834cc9c22ba496de7a378f3c301 Mon Sep 17 00:00:00 2001 From: Bung Date: Tue, 11 Oct 2022 17:42:49 +0800 Subject: fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' (#20522) * fix #7446 Generics: type mismatch 'SomeunsignedInt or Natural' * try fix --- tests/generics/t7446.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/generics/t7446.nim (limited to 'tests/generics') 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 -- cgit 1.4.1-2-gfad0