# P0006

Precondition violated: a `requires` clause of the function called is false, so the caller broke the contract. The message names the function and quotes the clause's condition. Spans the call. Every call evaluates the function's `requires` clauses, in every build, in the order written: after the arguments are evaluated and before the body runs. A clause sees the parameters and `self`. A panic while a clause is evaluated, such as an overflow, is reported as it is, not as `P0006`.

**Machine-applicable fix:** none.

## Example

This program fails with `P0006`.

```oska
fn double(x: Int) -> Int
    requires x > 0
{
    x * 2
}

fn main() {
    let y = double(-1)
}
```

## Fixed

The same program, fixed.

```oska
fn double(x: Int) -> Int
    requires x > 0
{
    x * 2
}

fn main() {
    let y = double(1)
}
```

Listed in the [runtime notes](/runtime.md#p0006). `oskac explain P0006` prints this entry offline.