OxL Reference

fn warn

Reports a diagnostic of the plugin's rule at at (its level comes from [lint], default warning).

Example:

oxl✓ checked in CI
use std.comptime { Decl, warn }

comptime fn long_names(d: Decl) {
  if d.name.len() > 40 {
    warn(d.span, "`{d.name}` is longer than 40 characters")
  }
}
@intrinsic("comptime.warn") pub(api) comptime fn warn(at: Span, message: str)

Since. 1.0.0-beta

Parameters

NameType
atSpan
messagestr

Errors

none; the rule's level (`warn`, `error` or `off`) decides whether the diagnostic stops the build.

Effects

none declared (pure unless the body says otherwise)

Defined in: std/comptime/comptime.oxl:202

See also