fixes output stream casting problem

This commit is contained in:
andri lim 2019-09-03 14:50:13 +07:00 • committed by zah
commit e7a34b74f2
2 changed files with 15 additions and 2 deletions

View file

@ -6,7 +6,9 @@ type
buffer: string buffer: string
startOffset: int startOffset: int
OutputStream* = object # somehow casting outputDevice to
# OutputStreamVar requires RootObj
OutputStream* = object of RootObj
cursor*: WriteCursor cursor*: WriteCursor
pages: Deque[OutputPage] pages: Deque[OutputPage]
endPos: int endPos: int

View file

@ -150,3 +150,14 @@ suite "output stream":
# The final outputs are the same # The final outputs are the same
check altOutput == memStream.getOutput check altOutput == memStream.getOutput
test "nim odd behavior":
# discovered in status-im/nim-snappy#2
proc encode(s: OutputStreamVar) =
check true
proc abc(s: OutputStreamVar) =
OutputStreamVar(s.outputDevice).encode
check true
var os = new OutputStream
os.abc()