diff options
author | Araq <rumpf_a@web.de> | 2014-11-30 02:56:26 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-30 02:56:26 +0100 |
commit | a1c217a2db6e3b263d4bc847d3f888f9ee63dc3c (patch) | |
tree | e2f0455b000d655617c9bb2e51bb10dbf03164df /tests | |
parent | c2e04abcfa6c4953820a1d24be8d9655c2c685c7 (diff) | |
download | Nim-a1c217a2db6e3b263d4bc847d3f888f9ee63dc3c.tar.gz |
fixes #1684
Diffstat (limited to 'tests')
-rw-r--r-- | tests/generics/tsubtypeconstraint.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/generics/tsubtypeconstraint.nim b/tests/generics/tsubtypeconstraint.nim new file mode 100644 index 000000000..2f0954522 --- /dev/null +++ b/tests/generics/tsubtypeconstraint.nim @@ -0,0 +1,13 @@ + +# bug #1684 +type + BaseType {.inheritable pure.} = object + idx: int + + DerivedType* {.final pure.} = object of BaseType + +proc index*[Toohoo: BaseType](h: Toohoo): int {.inline.} = h.idx +proc newDerived(idx: int): DerivedType {.inline.} = DerivedType(idx: idx) + +let d = newDerived(2) +assert(d.index == 2) |