diff options
Diffstat (limited to 'tests/generics/t5602_inheritence.nim')
-rw-r--r-- | tests/generics/t5602_inheritence.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/generics/t5602_inheritence.nim b/tests/generics/t5602_inheritence.nim new file mode 100644 index 000000000..6d48c796e --- /dev/null +++ b/tests/generics/t5602_inheritence.nim @@ -0,0 +1,18 @@ +discard """ + output: "seq[float]\n0" +""" + +# https://github.com/nim-lang/Nim/issues/5602 + +import typetraits + +type + Foo[T] = object of RootObj + Bar[T] = object of Foo[seq[T]] + +proc p[T](f: Foo[T]): T = + echo T.name + +var s: Bar[float] +echo p(s).len # the bug was: p(s) should return seq[float], but returns float instead + |