fixes #10542; suppresses varargs conversion warnings (#22757)

fixes #10542
revives and close #20169
This commit is contained in:
ringabout
2023-09-26 20:05:18 +08:00
committed by GitHub
parent 435f932088
commit a7a0cfe8eb
3 changed files with 27 additions and 2 deletions

24
tests/errmsgs/t10542.nim Normal file
View File

@@ -0,0 +1,24 @@
discard """
matrix: "--hintaserror:ConvFromXtoItselfNotNeeded"
"""
# bug #10542
proc f(args: varargs[string, string], length: int) =
doAssert args.len == length
# main use case that requires type conversion (no warning here)
f("a", "b", 2)
f("a", 1)
proc m(args: varargs[cstring, cstring]) =
doAssert args.len == 2
# main use case that requires type conversion (no warning here)
m("a", "b")
# if an argument already is cstring there's a warning
let x: cstring = "x"
m("a", x)
m(x, "a")