diff options
author | metagn <metagngn@gmail.com> | 2023-05-24 21:39:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 20:39:40 +0200 |
commit | 446e5fbbb3941820847ad209576493a73d78bb61 (patch) | |
tree | 86352eeaca9026667d80151ac64fd8cbda8a2f73 /tests/generics | |
parent | cb3f6fdc6665298ec2b75ade95ac7bc9af5a5f66 (diff) | |
download | Nim-446e5fbbb3941820847ad209576493a73d78bb61.tar.gz |
when T is both a type symbol and a routine symbol in scope of a generic proc do not account for the type symbol when doing `a.T()` (#21899)
fix #21883
Diffstat (limited to 'tests/generics')
-rw-r--r-- | tests/generics/mdotlookup.nim | 3 | ||||
-rw-r--r-- | tests/generics/timports.nim | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/generics/mdotlookup.nim b/tests/generics/mdotlookup.nim index 215f75003..090b97771 100644 --- a/tests/generics/mdotlookup.nim +++ b/tests/generics/mdotlookup.nim @@ -23,3 +23,6 @@ proc doStrip*[T](a: T): string = type Foo = int32 proc baz2*[T](y: int): auto = result = y.Foo + +proc set*(x: var int, a, b: string) = + x = a.len + b.len diff --git a/tests/generics/timports.nim b/tests/generics/timports.nim index df830c1f0..43f096664 100644 --- a/tests/generics/timports.nim +++ b/tests/generics/timports.nim @@ -40,6 +40,12 @@ block tdotlookup: doAssert doStrip(123) == "123" # bug #14254 doAssert baz2[float](1'i8) == 1 + # bug #21883 + proc abc[T: not not int](x: T): T = + var x = x + x.set("hello", "world") + result = x + doAssert abc(5) == 10 block tmodule_same_as_proc: # bug #1965 |