From c4ad8794eeaf8a4b9341dc7bbc75b0df5ff9362b Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Sat, 11 Nov 2023 15:40:06 +0100 Subject: [PATCH] fix: don't coalesce tag with underscore (#4274) ... in the coverage warnings. Repro: ``` Motoko type A = { #a : { f : Int; g : Text }; #b : (Char, Char); #c : ?Nat; #d : Nat }; var a : A = #d 42; switch a {case (#d 1) ()}; ``` Gives > stdin:13.1-13.26: warning [M0145], this switch of type > {#a : {f : Int; g : Text}; #b : (Char, Char); #c : ?Nat; #d : Nat} > does not cover value > #d(0 or 2 or _) or > #a(_) or **#b_** or #c(_) --- src/mo_frontend/coverage.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mo_frontend/coverage.ml b/src/mo_frontend/coverage.ml index 0c285f0e950..110c6e61b1c 100644 --- a/src/mo_frontend/coverage.ml +++ b/src/mo_frontend/coverage.ml @@ -141,7 +141,7 @@ let rec string_of_desc t = function | Tag (desc, l) -> let t' = T.lookup_val_field l (T.as_variant_sub l t) in if T.sub t' T.unit then "#" ^ l - else if T.is_tup t' then "#" ^ l ^ string_of_desc t' desc + else if T.is_tup t' then "#" ^ l ^ " " ^ string_of_desc t' desc else "#" ^ l ^ "(" ^ string_of_desc t' desc ^ ")" | NotTag ls -> let tfs = T.as_variant (T.promote t) in