E4086

E4086#

The labels are required by this function, but not supplied.

Sometimes this error occurs when you mistakenly treat a labelled argument as a positional argument. There are some common functions that require labelled arguments, such as:

  • @test.snapshot. Remember to supply filename as a labelled argument.

  • @test.inspect. Remember to supply content as a labelled argument.

错误示例#

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.
}

建议#

Check the signature of the function and provide the correct labelled argument.

pub fn f(name~ : String) -> Unit {
  println("Hello, \{name}")
}

fn main {
  f(name="John")
}