Files
Nim/tests/generics/tbadcache.nim
metagn fe55dcb2be test case haul before 2.2 (#24119)
closes #4774, closes #7385, closes #10019, closes #12405, closes #12732,
closes #13270, closes #13799, closes #15247, closes #16128, closes
#16175, closes #16774, closes #17527, closes #20880, closes #21346
2024-09-17 09:50:10 +08:00

27 lines
686 B
Nim

# issue #16128
import std/[tables, hashes]
type
NodeId*[L] = object
isSource: bool
index: Table[NodeId[L], seq[NodeId[L]]]
func hash*[L](id: NodeId[L]): Hash = discard
func `==`[L](a, b: NodeId[L]): bool = discard
proc makeIndex*[T, L](tree: T) =
var parent = NodeId[L]()
var tmp: Table[NodeId[L], seq[NodeId[L]]]
tmp[parent] = @[parent]
proc simpleTreeDiff*[T, L](source, target: T) =
# Swapping these two lines makes error disappear
var m: Table[NodeId[L], NodeId[L]]
makeIndex[T, L](target)
var tmp: Table[string, seq[string]] # removing this forward declaration also removes error
proc diff(x1, x2: string): auto =
simpleTreeDiff[int, string](12, 12)