fix #19862; make widestrs consistent between refc and orc (#19874) [backport]

fix #19862; make widestrs consistent in refc and orc
This commit is contained in:
flywind
2022-06-09 22:51:17 +08:00
committed by GitHub
parent 25d89269eb
commit 1972005439
2 changed files with 16 additions and 0 deletions

View File

@@ -224,3 +224,6 @@ when defined(nimv2):
proc `$`*(s: WideCStringObj): string =
$(s.data)
proc len*(w: WideCStringObj): int {.inline.} =
len(w.data)

13
tests/arc/t19862.nim Normal file
View File

@@ -0,0 +1,13 @@
discard """
matrix: "--gc:refc; --gc:arc"
"""
# bug #19862
type NewString = object
proc len(s: NewString): int = 10
converter toNewString(x: WideCStringObj): NewString = discard
let w = newWideCString("test")
doAssert len(w) == 4