-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Example
type
Loopable*[T] = concept x
x.len() is int
x[int] is T
x.items is T
iterator loop*[T](a: Loopable[T]): T = # TODO cannot access fields in iterator
for each in a:
yield each
type
Elem* = object
baa*: string
proc foo(elems: seq[Elem]): string =
for elem in elems.loop():
result &= "\n "
result &= $(elem.baa) # TODO Error: undeclared field: 'baa'
result &= "\n"
let elems = @[Elem(baa: "one"), Elem(baa: "two")]
echo foo(elems)
Current Output
Error: undeclared field: 'baa'
Expected Output
one
two
Additional Information
nim --version
Nim Compiler Version 1.4.8 [Windows: amd64]
Compiled at 2021-05-25
Copyright (c) 2006-2021 by Andreas Rumpf
nim --version
Nim Compiler Version 1.5.1 [Windows: amd64]
Compiled at 2021-09-01
Copyright (c) 2006-2021 by Andreas Rumpf