Sakura Lang

V9002 phase_unavailable

A compiler phase needed by this command is not implemented yet in this pre-alpha build.

An error from the internal phase. sakura explain V9002 prints this explanation offline.

A compiler phase needed by this command is not implemented yet in this pre-alpha build. The message names the missing piece (a backend feature, a @contract_test handler other than Effect.constructor(), …). Rewrite the program to avoid it, use another command or target (sakura check runs every front-end phase), or report it if the feature is documented as available.

Wrong program

compiler/tests/ui/V9002_contract_test_handler_unsupported.sakura, which the compiler's ui suite runs through sakura test --contracts:

@contract_test(handlers: [Log.captured(), 1])
pub fn half(x: Int) -> Int
  requires x > 0
{ x / 2 }

sakura test --contracts reports V9002.

Fixed program

compiler/tests/ui/V9002_contract_test_handler_unsupported.fixed.sakura, which sakura test --contracts accepts with no diagnostics:

import std/log.{Log}

@contract_test(handlers: [Log.captured()])
pub fn half(x: Int) -> Int
  ! {Log}
  requires x > 0
{
  Log.event(Level.Info, "halving", [])
  x / 2
}
Edit on GitHub

On this page