Skip to content

streams cannot compile with taint mode enabled #12968

@Sam647254

Description

@Sam647254

streams from the standard library fails to compile when compiling with taint mode enabled.

Example

import streams

Then 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

$ nim -v Nim Compiler Version 1.1.1 [Linux: amd64] Compiled at 2019-12-26 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions