adjust isomorphicCast to be Nim 2.2-compatible (#6633)

This commit is contained in:
tersec 2024-10-10 12:23:23 +00:00 committed by GitHub
parent 8a91d91b0d
commit 9ba31fb5e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -891,8 +891,9 @@ func getSizeofSig(x: auto, n: int = 0): seq[(string, int, int)] =
## ##
## These SHOULD be used in function calls to avoid expensive temporary. ## These SHOULD be used in function calls to avoid expensive temporary.
## see https://github.com/status-im/nimbus-eth2/pull/2250#discussion_r562010679 ## see https://github.com/status-im/nimbus-eth2/pull/2250#discussion_r562010679
template isomorphicCast*[T, U](x: U): T = template isomorphicCast*[T](x: auto): T =
# Each of these pairs of types has ABI-compatible memory representations. # Each of these pairs of types has ABI-compatible memory representations.
type U = typeof(x)
static: doAssert (T is ref) == (U is ref) static: doAssert (T is ref) == (U is ref)
when T is ref: when T is ref:
type type