Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

DiagnosticDirectives

Lowers one diagnostic selector to the allow level in lexical scope.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.compiler.prelude

import std.compiler.prelude;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

allow

pub directive allow(Selector: str);

Lowers one diagnostic selector to the allow level in lexical scope. Selector: Stable diagnostic code, hierarchical category, or warnings.

Example

module example.diagnostic_directives;
@allow("numeric.float-comparison")
fn AllowedComparison() -> bool { return 1.0 == 1.0; }
@warn("api.deprecated")
fn WarnOnDeprecatedUse() -> i32 { return 0; }
@deny("correctness.discarded-result")
fn RejectDiscardedResults() -> i32 { return 0; }
@forbid("warnings")
fn LockedWarningPolicy() -> i32 { return 0; }
fn Main() -> i32 {
    if !AllowedComparison() { return 1; }
    return WarnOnDeprecatedUse() + RejectDiscardedResults() +
        LockedWarningPolicy();
}

warn

pub directive warn(Selector: str);

Sets one diagnostic selector to warning level in lexical scope. Selector: Stable diagnostic code, hierarchical category, or warnings.

deny

pub directive deny(Selector: str);

Promotes one diagnostic selector to error level in lexical scope. Selector: Stable diagnostic code, hierarchical category, or warnings.

forbid

pub directive forbid(Selector: str);

Locks one diagnostic selector against lowering in nested scopes. Selector: Stable diagnostic code, hierarchical category, or warnings.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library