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

Error using toSeq in map #16439

Closed
hbwales opened this issue Dec 22, 2020 · 2 comments · Fixed by #24525
Closed

Error using toSeq in map #16439

hbwales opened this issue Dec 22, 2020 · 2 comments · Fixed by #24525

Comments

@hbwales
Copy link

hbwales commented Dec 22, 2020

Using toSeq in map causes and internal error

Example

import strutils, sequtils
var data = "aaa aaa"
echo data.split(" ").map(toSeq)

Current Output

Error: internal error: D:\a\nightlies\nightlies\nim-1.4.2\compiler\seminst.nim(328, 18)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

Expected Output

@[@['a', 'a', 'a'], @['a', 'a', 'a']]

Additional Information

$nim -v
Nim Compiler Version 1.4.2 [Windows: amd64]
@timotheecour
Copy link
Member

#11992 would fix this (and the general case as well), until then you can use mapIt instead of map

when true:
  import strutils, sequtils
  var data = "aaa aaa"
  echo data.split(" ").mapIt(toSeq(it))

@metagn
Copy link
Collaborator

metagn commented Nov 3, 2024

Doesn't crash and gives a proper error now (got template (x: untyped): untyped ...) which is reasonable to me

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