unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Empty code block in doc causes UCM exception #5349

Closed channingwalton closed 2 months ago

channingwalton commented 2 months ago

Describe and demonstrate the bug

Input in scratch.u:

README = {{{
}}

Then save the editor:

Encountered exception:
Prelude.last: empty list
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/List.hs:1644:3 in base:GHC.List
  errorEmptyList, called at libraries/base/GHC/List.hs:158:13 in base:GHC.List
  lastError, called at libraries/base/GHC/List.hs:153:29 in base:GHC.List
  last, called at src/Unison/Syntax/Lexer/Unison.hs:432:23 in unison-syntax-0.0.0-45p2Y49CWcnC6rok1OkVIc:Unison.Syntax.Lexer.Unison

Environment (please complete the following information):

aryairani commented 2 months ago

Sorry about that, thanks for the report.

It looks like it started here: 31f952, https://github.com/unisonweb/unison/pull/5187.