Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streams cannot compile with taint mode enabled #12968

Closed
Sam647254 opened this issue Dec 26, 2019 · 3 comments
Closed

streams cannot compile with taint mode enabled #12968

Sam647254 opened this issue Dec 26, 2019 · 3 comments

Comments

@Sam647254
Copy link
Contributor

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
@timotheecour
Copy link
Member

is taintMode really useful or should it become a (deprecated) no-op?

@Sam647254
Copy link
Contributor Author

nim-lang/RFCs#24
It has been discussed two years ago (as of this comment), but it still appears to be undecided.

@Araq Araq closed this as completed Dec 29, 2019
@Araq
Copy link
Member

Araq commented Dec 30, 2019

IMHO it should be removed for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants