Consider this code sample:
    
    
    proc foo(arr: openArray[string]): proc =
      result = proc =
        for i in arr:
          echo i
    
    
    const arr = @["qwe",]
    
    discard foo(arr)
    
    
    Run

This won't compile:
    
    
    Error: internal error: genTypeInfo(tyOpenArray)
    No stack traceback available
    To create a stacktrace, rerun compilation with './koch temp js <file>', see 
https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details
    
    
    Run

However, if I replace `openArray` with `seq`, it compiles:
    
    
    proc foo(arr: seq[string]): proc =
      result = proc =
        for i in arr:
          echo i
    
    
    const arr = @["qwe",]
    
    discard foo(arr)
    
    
    Run

Also, iterating over an `openArray` is fine if it's not done in the returned 
proc:
    
    
    proc foo(arr: seq[string]): proc =
      for i in arr:
        echo i
      result = proc =
        discard
    
    const arr = @["qwe",]
    
    discard foo(arr)
    
    
    Run

I think this may be a bug in the compiler that needs to be reported but I 
wanted to make sure it's not me doing some invalid stuff before I report it.

Reply via email to