Closed narimiran closed 3 days ago
This is a minimized, self-contained example of a code that works with Nim 2.0.6 and Nim 1.6.20, but it fails with Nim devel:
Nim devel
{.pragma: callback, gcsafe, raises: [].} type DataProc* = proc(val: openArray[byte]) {.callback.} GetProc = proc (db: RootRef, key: openArray[byte], onData: DataProc): bool {.nimcall, callback.} KvStoreRef* = ref object obj: RootRef getProc: GetProc template get(dbParam: KvStoreRef, key: openArray[byte], onData: untyped): bool = let db = dbParam db.getProc(db.obj, key, onData) func decode(input: openArray[byte], maxSize = 128): seq[byte] = @[] proc getSnappySSZ(db: KvStoreRef, key: openArray[byte]): string = var status = "not found" proc decode(data: openArray[byte]) = status = if true: "found" else: "corrupted" discard db.get(key, decode) status var ksr: KvStoreRef var k = [byte(1), 2, 3, 4, 5] proc foo(): string = getSnappySSZ(ksr, toOpenArray(k, 1, 3)) echo foo()
git bisect shows commit 5f9038a5d, i.e. PR https://github.com/nim-lang/Nim/pull/22716 as a first failing commit. (ping @metagn)
git bisect
5f9038a5d
Nim Compiler Version 2.1.1 [Linux: amd64] Compiled at 2024-06-20 Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 646bd99d461469f08e656f92ae278d6695b35778 active boot switches: -d:release
Error: ambiguous identifier 'decode' -- use one of the following: getSnappySSZ.decode: proc (data: openArray[byte]){.closure, noSideEffect, gcsafe.} filename.decode: proc (input: openArray[byte], maxSize: int): seq[byte]{.noSideEffect, gcsafe.}
compiles
No response
Description
This is a minimized, self-contained example of a code that works with Nim 2.0.6 and Nim 1.6.20, but it fails with
Nim devel
:git bisect
shows commit5f9038a5d
, i.e. PR https://github.com/nim-lang/Nim/pull/22716 as a first failing commit. (ping @metagn)Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64] Compiled at 2024-06-20 Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 646bd99d461469f08e656f92ae278d6695b35778 active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response