unison/unison-src/transcripts/fix2840.md
2024-06-25 11:11:07 -07:00

88 lines
2.3 KiB
Markdown

This bugfix addresses an issue where embedded Unison code in UCM was expected to be present in the active codebase when the `display` command was used render `Doc` values.
```ucm:hide
scratch/main> builtins.merge
```
First, a few \[hidden] definitions necessary for typechecking a simple Doc2.
```unison:hide:all
structural type Optional a = None | Some a
unique[b7a4fb87e34569319591130bf3ec6e24c9955b6a] type Doc2
= Word Text
| Code Doc2
| CodeBlock Text Doc2
| Bold Doc2
| Italic Doc2
| Strikethrough Doc2
| Style Text Doc2
| Anchor Text Doc2
| Blockquote Doc2
| Blankline
| Linebreak
| SectionBreak
| Tooltip Doc2 Doc2
| Aside Doc2
| Callout (Optional Doc2) Doc2
| Table [[Doc2]]
| Folded Boolean Doc2 Doc2
| Paragraph [Doc2]
| BulletedList [Doc2]
| NumberedList Nat [Doc2]
| Section Doc2 [Doc2]
| NamedLink Doc2 Doc2
| Image Doc2 Doc2 (Optional Doc2)
| Special Doc2.SpecialForm
| Join [Doc2]
| UntitledSection [Doc2]
| Column [Doc2]
| Group Doc2
unique[da70bff6431da17fa515f3d18ded11852b6a745f] type Doc2.SpecialForm
= Source [(Either Link.Type Doc2.Term, [Doc2.Term])]
| FoldedSource [(Either Link.Type Doc2.Term, [Doc2.Term])]
| Example Nat Doc2.Term
| ExampleBlock Nat Doc2.Term
| Link (Either Link.Type Doc2.Term)
| Signature [Doc2.Term]
| SignatureInline Doc2.Term
| Eval Doc2.Term
| EvalInline Doc2.Term
| Embed Any
| EmbedInline Any
-- A newtype used when embedding term references in a Doc2
unique[fb488e55e66e2492c2946388e4e846450701db04] type Doc2.Term = Term Any
syntax.docUntitledSection = cases
[d] -> d
ds -> UntitledSection ds
syntax.docParagraph = Paragraph
syntax.docWord = Word
```
```ucm
scratch/main> add
```
Next, define and display a simple Doc:
```unison:hide
README = {{
Hi
}}
```
```ucm
scratch/main> display README
```
Previously, the error was:
```
⚙️ Processing stanza 5 of 7.ucm: PE [("die",SrcLoc {srcLocPackage = "unison-parser-typechecker-0.0.0-He2Hp1llokT2nN4MnUfUXz", srcLocModule = "Unison.Runtime.Interface", srcLocFile = "src/Unison/Runtime/Interface.hs", srcLocStartLine = 118, srcLocStartCol = 18, srcLocEndLine = 118, srcLocEndCol = 60})] Lit
AnnotatedText (fromList [Segment {segment = "Unknown term reference: #4522d", annotation = Nothing}])
```
but as of this PR, it's okay.