From 9d09fda502b727890458e82ff58f7b603435de1e Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sun, 1 Mar 2026 08:55:10 -0500 Subject: [PATCH] Add \exhaustive\ annotation to exhaustive match blocks Ponyc recently added an \exhaustive\ annotation for match expressions. When present, the compiler will fail compilation if the match is not exhaustive. This protects against future breakage if new variants are added to a union type. --- examples/word-count/word-count.pony | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/word-count/word-count.pony b/examples/word-count/word-count.pony index 0c9ecba..311d2bf 100644 --- a/examples/word-count/word-count.pony +++ b/examples/word-count/word-count.pony @@ -77,7 +77,7 @@ class WordCountTotaler is fj.Collector[String, WordCounts iso] fun ref collect(runner: fj.CollectorRunner[String, WordCounts iso] ref, result: WordCounts iso) => - match _counts + match \exhaustive\ _counts | None => // We haven't gotten any counts yet, instead of copying the map, let's // just keep the first one as our base to build upon @@ -91,7 +91,7 @@ class WordCountTotaler is fj.Collector[String, WordCounts iso] end fun ref finish() => - match _counts + match \exhaustive\ _counts | None => _out.print("No words counted.") | let counts: WordCounts =>