Skip to content

Commit

Permalink
transcripts: Reset error state for all blocks
Browse files Browse the repository at this point in the history
Previously, once there was an `:error` (or `:bug`) block, all following
blocks would behave as if they had had an error. Except  `ucm` blocks
would correctly reset the state so that following blocks would behave
correctly again.

This moves the state reset to be shared by all blocks.

Fixes #5575.
  • Loading branch information
sellout committed Feb 13, 2025
1 parent c3b42f9 commit 8e040aa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 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
26 changes: 1 addition & 25 deletions unison-src/transcripts/idempotent/fix-5575.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,7 @@ foo =
* typeLink
```

But later blocks all act as if they have errors, even if they don’t.

``` unison :bug
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
```

But an intervening `ucm` block (regardless of whether it errors) will correct it.

``` ucm :hide
scratch/main> help
```
Later blocks should have their error state reset.

``` unison
foo : Nat
Expand Down
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 8e040aa

Please sign in to comment.