Warn

Emits a compiler warning at every call site of the annotated function. The function remains callable; the warning is informational.

Syntax

#Warn("Message")
func DoSomething() {
    // Implementation
}

Examples

Deprecation notice

#Warn("Use NewApi() instead; OldApi() will be removed in v2.0")
func OldApi() -> int32 {
    return NewApi();
}

func Main() -> int {
    OldApi(); // warning: Use NewApi() instead; OldApi() will be removed in v2.0
    return 0;
}

Unsafe operation advisory

#Warn("This function bypasses bounds checking; ensure the index is valid")
func UncheckedGet(arr: *int32, index: uint) -> int32 {
    return *(arr + index);
}

See Also

  • #Error — block usage outright instead of warning
  • Attributes — the full attribute set