Skip to content

Commit

Permalink
Add a transcript to test empty match
Browse files Browse the repository at this point in the history
It currently fails.
  • Loading branch information
sellout committed Aug 23, 2024
1 parent e388786 commit a1ba98e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
33 changes: 33 additions & 0 deletions unison-src/transcripts/fix4731.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
```unison
structural type Void =
```

```ucm
scratch/main> add
```

We should be able to `match` on empty types like `Void`.

```unison
Void.absurdly : '{e} Void ->{e} a
Void.absurdly v = match !v with
```

```unison
Void.absurdly : Void -> a
Void.absurdly v = match v with
```

And empty `cases` should also work.

```unison
Void.absurdly : Void -> a
Void.absurdly = cases
```

But empty function bodies are not allowed.

```unison:error
Void.absurd : Void -> a
Void.absurd x =
```
61 changes: 61 additions & 0 deletions unison-src/transcripts/fix4731.output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
``` unison
structural type Void =
```

``` 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`:
structural type Void
```
``` ucm
scratch/main> add
⍟ I've added these definitions:
structural type Void
```
We should be able to `match` on empty types like `Void`.

``` unison
Void.absurdly : '{e} Void ->{e} a
Void.absurdly v = match !v with
```

``` ucm
Loading changes detected in scratch.u.
😶
I expected some patterns after a match / with or cases but I
didn't find any.
2 | Void.absurdly v = match !v with
```



🛑

The transcript failed due to an error in the stanza above. The error is:


😶

I expected some patterns after a match / with or cases but I
didn't find any.

2 | Void.absurdly v = match !v with


0 comments on commit a1ba98e

Please sign in to comment.