tbadcache.nim 686 B

123456789101112131415161718192021222324252627
  1. # issue #16128
  2. import std/[tables, hashes]
  3. type
  4. NodeId*[L] = object
  5. isSource: bool
  6. index: Table[NodeId[L], seq[NodeId[L]]]
  7. func hash*[L](id: NodeId[L]): Hash = discard
  8. func `==`[L](a, b: NodeId[L]): bool = discard
  9. proc makeIndex*[T, L](tree: T) =
  10. var parent = NodeId[L]()
  11. var tmp: Table[NodeId[L], seq[NodeId[L]]]
  12. tmp[parent] = @[parent]
  13. proc simpleTreeDiff*[T, L](source, target: T) =
  14. # Swapping these two lines makes error disappear
  15. var m: Table[NodeId[L], NodeId[L]]
  16. makeIndex[T, L](target)
  17. var tmp: Table[string, seq[string]] # removing this forward declaration also removes error
  18. proc diff(x1, x2: string): auto =
  19. simpleTreeDiff[int, string](12, 12)