From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D8AC9BC69 for ; Thu, 8 Feb 2007 19:01:55 +0100 (CET) Received: from orion.metastack.com (no-dns-yet.demon.co.uk [80.177.38.218] (may be forged)) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l18I1rPc024445 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 8 Feb 2007 19:01:55 +0100 Received: from treble (cpc2-cmbg6-0-0-cust535.cmbg.cable.ntl.com [81.107.34.24]) (authenticated bits=0) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id l18HH6XE023570 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 8 Feb 2007 17:17:08 GMT From: "David Allsopp" To: "OCaml List" Subject: More intelligent match warnings Date: Thu, 8 Feb 2007 18:01:50 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <005501c74bab$369f5150$6a7ba8c0@treble> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AcdLqzUmCeC1d9uZQ5atwRYIqN4n7g== X-Miltered: at discorde with ID 45CB6591.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compiler:01 emits:01 constructors:01 decidable:01 wrote:01 match:02 match:02 incomplete:03 incomplete:03 warnings:03 let:03 let:03 incorrect:06 cases:08 rather:08 Say I write the following rather pointless piece of code: type t = A | B | C let f x = match x with A -> 1 | _ -> match x with B -> 2 | C -> 3 The compiler emits Warning P for the second match because it's incomplete over the constructors of type t. However, it's not really incomplete because the branch cannot be hit if x = A so the warning is "sort of" incorrect. In fact, it would also be good if one wrote: type t = A | B | C let f x = match x with A -> 1 | _ -> match x with A -> 1 (* XX *) | B -> 2 | C -> 3 to get a warning that the branch marked XX cannot be reached. Are these two cases decidable in the general case? David