E4190

E4190#

Compiler diagnostic name: mbt_check_fatal_error.

Fatal syntax error in an mbt check documentation block.

Code fences marked as mbt check in doc comments are parsed as document tests. If a block contains fatal syntax errors, MoonBit skips that block and reports this diagnostic on the code fence.

Erroneous example#

The following doc comment has an incomplete let binding inside an mbt check block:

/// Returns the answer.
///
/// ```mbt check
/// test {
///   let value =
/// }
/// ```
pub fn answer() -> Int {
  42
}

MoonBit will report an error.

Suggestion#

Fix the syntax inside the documentation block. When the block is meant to be checked as a doctest, wrap executable statements in test { ... }:

/// Returns the answer.
///
/// ```mbt check
/// test {
///   inspect(answer(), content="42")
/// }
/// ```
pub fn answer() -> Int {
  42
}