E4121#
这个应用中不允许使用 !、? 或 !! 标记。
这个错误发生在以下情况:
!、?或!!标记用于构造函数。该标记用于不适合的函数。
!只能用于会引发错误或异步的函数应用。!!只能用于异步函数应用。
错误示例#
///|
pub enum Err {
IntErr(Int)
}
///|
fn square(x : Int) -> Int {
x * x
}
///|
pub fn invalid_attribute() -> Unit {
square!!(1) |> ignore()
// Error: The attribute `!!` cannot be used on application that does not raise
// errors.
}
建议#
从应用中移除 !、? 或 !! 标记。
///|
pub enum Err {
IntErr(Int)
}
///|
fn square(x : Int) -> Int {
x * x
}
///|
pub fn constructor_value() -> Err {
IntErr(1)
}
///|
pub fn square_value() -> Int {
square(2)
}