From a1ba98e38a88d72a477a1ba21842a875b837fbf4 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Thu, 22 Aug 2024 23:24:50 -0600 Subject: [PATCH] Add a transcript to test empty `match` It currently fails. --- unison-src/transcripts/fix4731.md | 33 +++++++++++++ unison-src/transcripts/fix4731.output.md | 61 ++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 unison-src/transcripts/fix4731.md create mode 100644 unison-src/transcripts/fix4731.output.md diff --git a/unison-src/transcripts/fix4731.md b/unison-src/transcripts/fix4731.md new file mode 100644 index 0000000000..974a55db33 --- /dev/null +++ b/unison-src/transcripts/fix4731.md @@ -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 = +``` diff --git a/unison-src/transcripts/fix4731.output.md b/unison-src/transcripts/fix4731.output.md new file mode 100644 index 0000000000..2633daf7a1 --- /dev/null +++ b/unison-src/transcripts/fix4731.output.md @@ -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 + +