-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
streams from the standard library fails to compile when compiling with taint mode enabled.
Example
import streamsThen compile with --taintMode:on
Current Output
Compilation fails with the following:
/mnt/c/Users/Sam/Documents/Nim/lib/pure/streams.nim(904, 11) Error: type mismatch: got <TaintedString, int literal(0)>
but expected one of:
proc setLen[T](s: var seq[T]; newlen: Natural)
first type mismatch at position: 1
required type for s: var seq[T]
but expression 'line' is of type: TaintedString
proc setLen(s: var string; newlen: Natural)
first type mismatch at position: 1
required type for s: var string
but expression 'line' is of type: TaintedString
Expected Output
(should compile successfully)
Possible Solution
Going to the line of code in the error message reveals:
when nimvm: #Bug #12282
line.setLen(0)
else:
line.string.setLen(0)The easiest solution may be to borrow setLen (and add, which is used later in streams) from string.
Additional Information
- The issue is essentially identical to httpclient import causes compiler error with taint mode #12789 but happening in
streamsinstead ofhttpclient(in fact, I encountered this when trying to reproduce that issue)
$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2019-12-26
Metadata
Metadata
Assignees
Labels
No labels