fixes #1684
This commit is contained in:
parent
c2e04abcfa
commit
a1c217a2db
2 changed files with 17 additions and 0 deletions
13
tests/generics/tsubtypeconstraint.nim
Normal file
13
tests/generics/tsubtypeconstraint.nim
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue