Skip to content

@typecheck fenced code block Doc elements randomly swap example code #3485

Open
@rlmark

Description

This issue with Doc elements was surfaced earlier this week. Code examples in @typecheck fenced codeblock elements are swapped with other code examples from @typecheck block elements, leading to an odd docs reading experience.

The example code chosen in the doc is wrong for docs.to-html and display. The view command displays the source appropriately and the source code is correct, so this appears to be specific to the process of rendering the doc for a viewer/html.

The example chosen is deterministic per command run, so display myDoc will always select the same example to render.

It's most visible on the website (large docs based codebase) with multiple @typecheck fenced codeblock elements. I was unfortunately not able to repro this in the small case with only a few docs. A live example of this issue is located in the website codebase, in the term website.learn.fundamentals.controlFlow._dataTypesPatternMatching

The following commands will let you see the problem in doc rendering:

.> pull unison.public.website.learn website.learn
.website.learn> docs.to-html fundamentals.controlFlow._dataTypesPatternMatching
.website.learn> display fundamentals.controlFlow._dataTypesPatternMatching

The source code reads:

       @typecheck ```
       placeSetting : Lunch -> [Utensil]
       placeSetting = cases
         Soup soupName   -> [Spoon]
         Salad saladName -> [Fork, Knife]
         _               -> [Spoon, Fork, Knife]
       ```

However, the code snippet chosen on display is:

    @typecheck ```
    getByteSize : (Text, Bytes, Text) -> Nat
    getByteSize tuple3 =
      "tuple decomposition 👇"
      let
        (first, bytes, last) = tuple3
        size (toUtf8 first ++ bytes ++ toUtf8 last)
    ```

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions