From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id C83B47FECC for ; Wed, 15 Jun 2016 11:27:50 +0200 (CEST) IronPort-PHdr: 9a23:Jl5zjBxPoUpwvBHXCy+O+j09IxM/srCxBDY+r6Qd0e8UIJqq85mqBkHD//Il1AaPBtWKraIawLKG+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U35r8j7D60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGxmgO8678NLTYn9eq05S/QYUGVnYCgJ45jgvBzHCA+O/Wc0U2MMkxMODRKWwgv9W8L2uTfzvepn3y/Sacr9UbkcQTOm/qxrTwXvjmEJLWhqoynslsVsgfcD81qarBtlztuIMYw= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=octa@polychoron.fr; spf=None smtp.mailfrom=octa@polychoron.fr; spf=None smtp.helo=postmaster@slow1-d.mail.gandi.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of octa@polychoron.fr) identity=pra; client-ip=217.70.178.86; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="octa@polychoron.fr"; x-sender="octa@polychoron.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of octa@polychoron.fr) identity=mailfrom; client-ip=217.70.178.86; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="octa@polychoron.fr"; x-sender="octa@polychoron.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@slow1-d.mail.gandi.net) identity=helo; client-ip=217.70.178.86; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="octa@polychoron.fr"; x-sender="postmaster@slow1-d.mail.gandi.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BJBACBHmFXflayRtlDGoQUK1IBBal7kRyBeSKFdQKBODoSAQEBAQEBAQERAQEJDQkJIS9BEoFeghsBAQQnCwEFNhsLGA0hRRITBgIBAQ6IBAMbCi25UQODfQwlhiaBeIJWhDBchQ8FhkcMkhaCIINliluHDoVdhx+IVSUMhBRsAYZ1ghMBfgEBAQ X-IPAS-Result: A0BJBACBHmFXflayRtlDGoQUK1IBBal7kRyBeSKFdQKBODoSAQEBAQEBAQERAQEJDQkJIS9BEoFeghsBAQQnCwEFNhsLGA0hRRITBgIBAQ6IBAMbCi25UQODfQwlhiaBeIJWhDBchQ8FhkcMkhaCIINliluHDoVdhx+IVSUMhBRsAYZ1ghMBfgEBAQ X-IronPort-AV: E=Sophos;i="5.26,475,1459807200"; d="scan'208";a="181326240" Received: from slow1-d.mail.gandi.net ([217.70.178.86]) by mail3-smtp-sop.national.inria.fr with ESMTP; 15 Jun 2016 11:27:50 +0200 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by slow1-d.mail.gandi.net (Postfix) with ESMTP id 75B55496846 for ; Wed, 15 Jun 2016 11:21:59 +0200 (CEST) X-Originating-IP: 37.162.199.120 Received: from [192.168.42.220] (unknown [37.162.199.120]) (Authenticated sender: octa@polychoron.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 394BB41C0AD for ; Wed, 15 Jun 2016 11:20:59 +0200 (CEST) To: caml-list@inria.fr References: <1465980742.269779.638209889.162FFE6E@webmail.messagingengine.com> From: octachron Message-ID: <87b025f9-4d31-192e-15ad-1b26c5bde5ba@polychoron.fr> Date: Wed, 15 Jun 2016 11:20:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1465980742.269779.638209889.162FFE6E@webmail.messagingengine.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Odd type error reporting The mantis ticket might be this one: http://caml.inria.fr/mantis/view.php?id=6931 Regards, octachron. Le 06/15/16 à 10:52, Leo White a écrit : > This bug was fixed in 4.03.0: > > Characters 29-32: > let () = { f = fun bar -> { bar } };; > ^^^ > Error: This record expression is expected to have type foo > The field bar does not belong to type foo > > I vaguely remember a mantis about this (or a similar issue) and that > it was resolved, but I don't have its PR number to hand. > > Regards, > > Leo > > On Wed, 15 Jun 2016, at 03:37 AM, Christoph Höger wrote: >> Dear all, >> >> It just took me 30min to figure out a rather simple type-error in my >> code. It was complicated by ocamlc's strange error reporting. Consider >> this example: >> >> % cat error.ml >> type foo = { foo : int } >> type bar = { bar : int } >> type baz = { f : int -> foo } >> >> let () = { f = fun bar -> { bar } } >> % ocamlc error.ml >> File "error.ml", line 5, characters 28-31: >> Error: This record expression is expected to have type baz >> The field bar does not belong to type foo >> >> >> >> ocamlc correctly spots the "bar" in the last line as the source of the >> error. However, it says, it is expected to have type "baz", but that is >> the surrounding constructor. >> >> In fact, the "correct" error is: >> >> File "error.ml", line 5, characters 26-33: >> Error: This record expression is expected to have type foo >> The field bar does not belong to type foo >> >> >> >> Obviously, in a perfect world, the wrongly labeled field should be >> pointed out as well (kind of a sub-error). However, it seems problematic >> that the outermost record-mismatch is reported. >> >> Is this a known bug/feature? Does it change in later versions (I am on >> 4.02.3 now)? >> >> thanks, >> >> Christoph >> -- >> Christoph Höger >> >> Technische Universität Berlin >> Fakultät IV - Elektrotechnik und Informatik >> Übersetzerbau und Programmiersprachen >> >> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin >> >> Tel.: +49 (30) 314-24890 >> E-Mail: christoph.hoeger@tu-berlin.de >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs