mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-31 02:43:41 +00:00
24
tests/errmsgs/t10542.nim
Normal file
24
tests/errmsgs/t10542.nim
Normal 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")
|
||||
Reference in New Issue
Block a user