delay markUsed for converters until call is resolved (#24243)

fixes #24241

(cherry picked from commit 09043f409f)
This commit is contained in:
metagn
2024-10-06 09:10:37 +03:00
committed by narimiran
parent 599f1ad6b3
commit 75e50f804a
5 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
# issue #24241
{.warningAsError[Deprecated]: on.}
type X = distinct int
converter toInt(x: X): int{.deprecated.} = int(x)
template `==`(a, b: X): bool = false # this gets called so we didn't convert
doAssert not (X(1) == X(2))
doAssert not compiles(X(1) + X(2))
doAssert not (compiles do:
let x: int = X(1))