E4076

E4076#

缺少返回值的类型注释。

MoonBit 要求所有顶层函数都具有完整的类型注释。人们常常会忘记包含函数的返回类型,尤其是在函数返回 Unit 时。

错误示例#

fn f() { // Error: Missing type annotation for the return value.
}

建议#

添加函数的返回类型:

fn f() -> Unit {
}