E0042

E0042#

Invalid attribute.

This warning will be emitted when the program contain attribute unrecognized by MoonBit, or the syntax of attribute has incorrect shape.

Erroneous example#

// unrecognized attribute
#unrecognized
fn f() -> Unit {}

// `#deprecated` can accept at most one message
#deprecated("multiple", "message")
fn g() -> Unit {}

Suggestion#

Check if there is typo in the attribute declaration, and check the document of the attribute for the arguments it accept. If you intend to write a attribute for use by foreign tools, make sure the attribute's name is #xxx.yyy, such as #coverage.skip, so that MoonBit will treat it as a foreign attribute and ignore it.