Skip to content

Commit

Permalink
Fix string stream crashing when created on nimscript due to last fix (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
beef331 committed Apr 14, 2022
1 parent ef7d7f2 commit dc4cc2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pure/streams.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ else: # after 1.3 or JS not defined

new(result)
result.data = s
when defined(gcOrc) or defined(gcArc):
when declared(prepareMutation):
prepareMutation(result.data) # Allows us to mutate using `addr` logic like `copyMem`, otherwise it errors.
result.pos = 0
result.closeImpl = ssClose
Expand Down
4 changes: 4 additions & 0 deletions tests/stdlib/tstreams.nim
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ block:
doAssert(ss.getPosition == 5) # haven't moved
ss.setPosition(0) # Ensure we dont error with writing over literals on arc/orc #19707
ss.write("hello")

static: # Ensure streams it doesnt break with nimscript on arc/orc #19716
let s = newStringStream("a")
discard s.data

0 comments on commit dc4cc2d

Please sign in to comment.