Literate MoonBit semantic docs

This single-file example is intentionally written as a small literate document. The prose stays as Markdown, while only mbt check fences are compiled and annotated with semantic hover and definition data.

mbt check
22fn answerfn answer() -> Int() -> IntInt {
23  let cell@ref.Ref[Int] : @refstruct @ref.Ref[T] {.Refstruct @ref.Ref[T] {[IntInt] = { valInt: 41 }
24  cell@ref.Ref[Int].valT + 1
25}

Plain Markdown between checked blocks should render as prose, not as code. A non-MoonBit code fence should also remain plain and should not receive semantic links:

text
33answer() and @ref.Ref[Int] are text here, not MoonBit references.

The following block is checked together with the earlier one, so answer can be called across Markdown boundaries.

mbt check
40fn doubledfn doubled(n : Int) -> Int(nInt : IntInt) -> IntInt {
41  nInt + nInt
42}
43
44///|
45test "answer" {
46  inspectfn inspect(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError(answerfn answer() -> Int(), contentString="42")
47  inspectfn inspect(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError(doubledfn doubled(n : Int) -> Int(21), contentString="42")
48}