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 2C79E7FECC for ; Wed, 15 Jun 2016 10:52:26 +0200 (CEST) IronPort-PHdr: 9a23:Ft1XCh+jYYooH/9uRHKM819IXTAuvvDOBiVQ1KB91+McTK2v8tzYMVDF4r011RmSDdSdu68P0rCI+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U35n8jrrss7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYjck87NZNWrnWeKExTLoQTGh3cjN92Mq+vhDGSU6L52AAemQQiBtBRQbfvz/gWZKklib9/tV92TWXdZnyQLccXSy9tfotThL03nRUfwUl+X3a35QjxJlQpwis8kAuzg== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=leo@lpw25.net; spf=None smtp.mailfrom=leo@lpw25.net; spf=None smtp.helo=postmaster@out3-smtp.messagingengine.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=pra; client-ip=66.111.4.27; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=mailfrom; client-ip=66.111.4.27; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@out3-smtp.messagingengine.com) identity=helo; client-ip=66.111.4.27; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="postmaster@out3-smtp.messagingengine.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A8AgBLFmFXfhsEb0JdhBR9qhSRHIF5FwuFdQKBODoSAQEBAQEBAQERAQEJDQkJIS+CMYIbAQEEJxkuDA8LGA0QESwZEhkSiAQDFw6xO4g+A4Eggl0BAQEBAQUBAQEBAQEBARcIiCaCToUMgX0LQBiCL4ZMDIdWij8BhgWKW4xrj3QlCoQwIDKKCAEBAQ X-IPAS-Result: A0A8AgBLFmFXfhsEb0JdhBR9qhSRHIF5FwuFdQKBODoSAQEBAQEBAQERAQEJDQkJIS+CMYIbAQEEJxkuDA8LGA0QESwZEhkSiAQDFw6xO4g+A4Eggl0BAQEBAQUBAQEBAQEBARcIiCaCToUMgX0LQBiCL4ZMDIdWij8BhgWKW4xrj3QlCoQwIDKKCAEBAQ X-IronPort-AV: E=Sophos;i="5.26,475,1459807200"; d="scan'208";a="181319845" Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2016 10:52:24 +0200 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8D5F8205EF for ; Wed, 15 Jun 2016 04:52:22 -0400 (EDT) Received: from web1 ([10.202.2.211]) by compute4.internal (MEProxy); Wed, 15 Jun 2016 04:52:22 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=lpw25.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=ed9NslRIZztsfQ8L+G4gHnpMTrs=; b=DqCig9 LxZgyq8q8YmNI35CHyg9GY0HdHIJgQEthdyF3vY9vkxCclnfB9i4IV8dmd7vyQNQ KEQf5FIeYJORk4Tvz+NmvcsSN0OAhItBcHRj6d0YpG1UwoItPDFW9Qn24EsaeaI7 eOnMBukTVb+vW+yyG4OkDMB3e6/TQ+nLS4M6U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ed9NslRIZztsfQ8 L+G4gHnpMTrs=; b=UWb/xLgBU66Ifl4QX4q/kU2sg+aJFOyIUMarc6pZ2OJvhrw 9/VfSJh5PYBNASEDivBglMpqeIkSrKzkN9nf1a9QMzoWmupaXvCU0NQIF2k2u0jC ndomwS4ph0/0/Pd2Qy6GMBp4DDgOG0jQpjD8P3U3aMOgIxENYhWVOg16pHqQ= Received: by mailuser.nyi.internal (Postfix, from userid 99) id 528986A1E3; Wed, 15 Jun 2016 04:52:22 -0400 (EDT) Message-Id: <1465980742.269779.638209889.162FFE6E@webmail.messagingengine.com> X-Sasl-Enc: N0X/1Ft/38kmXFYkHRWCZTmcToCS019kucMJH0FcNLOl 1465980742 From: Leo White To: caml-list@inria.fr MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: MessagingEngine.com Webmail Interface - ajax-aff28cd1 Date: Wed, 15 Jun 2016 04:52:22 -0400 In-Reply-To: References: Subject: Re: [Caml-list] Odd type error reporting This bug was fixed in 4.03.0: Characters 29-32: let () =3D { f =3D 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=F6ger wrote: > Dear all, >=20 > 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: >=20 > % cat error.ml > type foo =3D { foo : int } > type bar =3D { bar : int } > type baz =3D { f : int -> foo } >=20 > let () =3D { f =3D 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 >=20 >=20 >=20 > 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. >=20 > In fact, the "correct" error is: >=20 > 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 >=20 >=20 >=20 > 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. >=20 > Is this a known bug/feature? Does it change in later versions (I am on > 4.02.3 now)? >=20 > thanks, >=20 > Christoph > --=20 > Christoph H=F6ger >=20 > Technische Universit=E4t Berlin > Fakult=E4t IV - Elektrotechnik und Informatik > =DCbersetzerbau und Programmiersprachen >=20 > Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin >=20 > Tel.: +49 (30) 314-24890 > E-Mail: christoph.hoeger@tu-berlin.de >=20 > --=20 > 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