-
-
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
unexpected behavior of the "of" operator #178
Comments
this code refuses to compile, but should IMHO - aborts with: I guess the problem is related to the "of" problem , therefore I don't open a new issue: type
PBtree* [T,D] = ref TBTree[T,D]
TItem* [T,D] = object
key* : T
value* : D
node: PBtree[T,D]
when not (D is string):
val_set: Bool
TItems[T,D] = seq[ref TItem[T,D]]
TBTree* [T,D] = object
slots: TItems[T,D]
left: PBtree[T,D]
count: Int32
RPath[T,D] = tuple[
Xi: Int,
Nd: PBtree[T,D] ]
PTreeIterator* [T,D] = ref TTreeIterator[T,D]
TTreeIterator* [T,D] = object
path: array[0..30, RPath[T,D]]
level: int
current: ref TItem[T,D]
PKeysIterator* [T,D] = ref TKeysIterator [T,D]
TKeysIterator* [T,D] = object of TTreeIterator[T,D]
proc initIterator [T,D] (it: PTreeIterator[T,D], n: PBtree[T,D]) {.inline.} =
it.Path[0].Nd = n
it.Path[0].Xi = -1
proc keys* [T,D](n: PBtree[T,D]): PKeysIterator[T,D] =
new(result)
initIterator(result, n)
var
root: PBTree[string, int]
iter = keys(root)
|
Sigh ... See bug #88 ... |
sorry for double posting - I haven't seen the other issue. Currently a cast helps in the second example. |
178: minor refactor of unittest implementation r=saem a=krux02 generally speaking unittesting is very important, but the unittest modules causes nothing but problems. The problem is, unittest pretty much uses all problematic metaprogramming APIs at the same time. This should be changed, step by step. * `template print(a,b: untyped)` -> `proc print[T](name: string, value: T)` * `newIdentNode(":c" & $counter)` -> `genSym` * `template assign` -> `newVarStmt` Co-authored-by: Arne Döring <a.doering@digiblue.de>
I think this should compile, but it does not:
The text was updated successfully, but these errors were encountered: