-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
internal error: not part of closure object type #19984
Comments
Sudoku_D.nim.gz |
the problem is |
Why is this a problem? Due to a recent patch, closure iterators are recursive. |
maybe it's just a unhandled case , when I commented the error reporting it compiles and runs but get |
I have reduced the size of the code to less than 50 lines. git hash: 31ba104 |
From bug3.nim.txt: #!/usr/bin/env nimr
import std/[sets, tables, sequtils]
type
i8 = int8
seq8 = seq[int8]
Cell = seq8
NODE = tuple[d_in:int8,Strong:bool,link:Cell]
PATH = seq[NODE]
var
R_Cells : int = -1
max_level : int
var
Seen:HashSet[NODE]
path:PATH
iterator Loop_next(strong_link:bool, d_in:int8, node:Cell, head:int8,
Seen:var HashSet[NODE], path: var PATH, level:int ) : PATH {.closure.} =
if level > max_level :
return
let GNode= len(node) > 1 # without this line, the code compiles
var
rt, ct, st : seq8
column_type : bool
#[ with this code commented out the compiler error does not occurs ]#
st= filter(st, proc(x:int8) : bool = x notin node)
if column_type :
rt= @[]
ct= filter(ct, proc(x:int8) : bool = x notin node)
else : # row type
rt= filter(rt, proc(x:int8) : bool = x notin node)
ct= @[]
#[]#
iterator Nice_Loop( ) : PATH {.closure.} =
for cell in 0i8..80i8 :
let head= cell
for pt in Loop_next(true,0.i8,@[cell], head,Seen,path,0) :
yield pt
for P in Nice_Loop() :
continue
|
I am trying the new recursive closure iterators.
A simple example works just fine.
But a larger one fails with
internal error: not part of closure object type
Unfortunately trying to come up with a smaller example source file (just the iterator is reference in the error message)
doesn't show the error.
So, I have to attach the full file with more than 2700 lines.
The error message is
Sudoku.nim(592, 18) Error: internal error: not part of closure object type
Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2022-07-07
git hash: 430a179
The text was updated successfully, but these errors were encountered: