Skip to content

Commit

Permalink
Merge pull request #5579 from sellout/fix-transcript-error-blocks
Browse files Browse the repository at this point in the history
transcripts: Reset error state for all blocks
  • Loading branch information
aryairani authored Feb 13, 2025
2 parents 8d287d6 + 8e040aa commit bb88817
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion unison-cli/src/Unison/Codebase/Transcript/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ run isTest verbosity dir codebase runtime sbRuntime nRuntime ucmVersion baseURL
writeIORef isHidden $ hidden infoTags
writeIORef allowErrors $ expectingError infoTags
writeIORef expectFailure $ hasBug infoTags
writeIORef hasErrors False
traverse_ (atomically . Q.enqueue cmdQueue . Just) cmds
atomically . Q.enqueue cmdQueue $ Nothing
Cli.returnEarlyWithoutOutput
Expand Down Expand Up @@ -401,6 +400,7 @@ run isTest verbosity dir codebase runtime sbRuntime nRuntime ucmVersion baseURL
liftIO $ writeIORef isHidden Shown
liftIO $ writeIORef allowErrors False
liftIO $ writeIORef expectFailure False
liftIO $ writeIORef hasErrors False
maybe (liftIO finishTranscript) (uncurry processStanza) =<< atomically (Q.tryDequeue inputQueue)

awaitInput :: Cli (Either Event Input)
Expand Down
56 changes: 56 additions & 0 deletions unison-src/transcripts/idempotent/fix-5575.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
``` ucm :hide
scratch/main> builtins.merge lib.builtin
```

A first `:error` block works as expected.

``` unison :error
foo : Nat
foo =
1 +
```

``` ucm :added-by-ucm
Loading changes detected in scratch.u.
I got confused here:
4 |
I was surprised to find an end of section here.
I was expecting one of these instead:
* bang
* do
* false
* force
* handle
* if
* let
* newline or semicolon
* quote
* termLink
* true
* tuple
* typeLink
```

Later blocks should have their error state reset.

``` unison
foo : Nat
foo =
1 + 2
```

``` ucm :added-by-ucm
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
foo : Nat
```
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ test = cases

## Complete patterns with guards should be accepted

``` unison :error
``` unison
test : Optional Nat -> Nat
test = cases
None -> 0
Expand Down

0 comments on commit bb88817

Please sign in to comment.