Lyricdev
GitHub

LYR-SEM0076

a use of a deprecated declaration

warning · spec 11-metaprogramming · lint deprecated, group deprecation, warn unless said

A declaration or module marked @Deprecated is used or imported outside another deprecated declaration.

Explanation

@Deprecated marks a declaration that is on its way out; each use warns with the attribute's message, and a note points at the attribute. When the attribute names a replacement, the warning says what to write instead. Uses inside a declaration that is itself deprecated do not warn.

Move the use to the replacement the message names.

Wrong

@Deprecated { message = "use 'next'" }
fn old(): int {
    return 1;
}

fn main(): void {
    let _ = old();
}
@Deprecated { message = "use 'next'" }
fn old(): int {
    return 1;
}

fn next(): int {
    return 2;
}

fn main(): void {
    let _ = next();
}