E4086#
这个函数需要标签,但没有提供。
有时,当您错误地将带标签的参数视为位置参数时,会发生此错误。一些常用的函数需要带标签的参数,例如:
@test.snapshot
请提供filename
作为带标签的参数。@test.inspect
请提供content
作为带标签的参数。
错误示例#
pub fn f(name~ : String) -> Unit {
println("Hello, \{name}")
}
fn main {
f("John") // Error: The labels name~ are required by this function, but not supplied.
}
建议#
检查函数的签名并提供正确的带标签参数。
pub fn f(name~ : String) -> Unit {
println("Hello, \{name}")
}
fn main {
f(name="John")
}