E4115#
Cannot auto-fill parameter of this type.
MoonBit supports and auto-filling SourceLoc and ArgsLoc parameters in
functions. Leaving the default value of parameter of other types will result in
this error.
Erroneous example#
///|
#callsite(autofill(parameter))
fn f(parameter~ : Int) -> Unit {
// ^~~~~~~~~ Error: Cannot auto-fill parameter of type Int
}
Suggestion#
Use a default value for the parameter:
///|
pub fn f(parameter? : Int = 0) -> Int {
parameter
}
///|
test {
inspect(f(), content="0")
inspect(f(parameter=1), content="1")
}