E3021

E3021#

Compiler diagnostic name: invalid_warn_list.

Invalid warning list.

MoonBit warning lists are strings that enable or disable warnings by name or number. They are accepted in places such as moon.pkg.json warn-list and the #warnings attribute. This error happens when the warning list cannot be parsed, for example because it contains an unknown warning name or malformed syntax.

Erroneous example#

#warnings("-does_not_exist")
fn f() -> Unit {
  ()
}

does_not_exist is not a known warning name.

Suggestion#

Use a valid warning name or warning number. Warning names are the identifiers shown in compiler diagnostics, such as unused_value.

#warnings("-unused_value")
fn f() -> Unit {
  ()
}