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 889387FECC for ; Wed, 15 Jun 2016 09:37:25 +0200 (CEST) IronPort-PHdr: 9a23:Ya34BhIhj/ebxvytqdmcpTZWNBhigK39O0sv0rFitYgULPjxwZ3uMQTl6Ol3ixeRBMOAu6MC27ed6vm4EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35Xxh735osSLKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46FppIZ8VvDxdqE8BaFDAS49ezQ+7cjv8B3CVhen530GU2xQnAAeUCbf6xSvdZfrszDmsfJ97wkEMsDsBeQ/WS6j9LtsUB+uiCAKODMj2H3Kz8Z9lqZaplStqkoskMbvfIiJOa8mLevmdtQASD8ZUw== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=christoph.hoeger@tu-berlin.de; spf=None smtp.mailfrom=christoph.hoeger@tu-berlin.de; spf=None smtp.helo=postmaster@mail.tu-berlin.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=pra; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=mailfrom; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.tu-berlin.de) identity=helo; client-ip=130.149.7.33; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="postmaster@mail.tu-berlin.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BNAgB4BGFXfiEHlYJdhBQrUr0zGoc3OxEBAQEBAQEBAREBAQsLCQkhL4IxgkQECwF7AiYCXw0GAgEBiCwEnSaPYpE4gQGHHQiKD4JaBZhpgTGEVIpbhwqFYY90NIFWAQEIAgGCLmyKCAEBAQ X-IPAS-Result: A0BNAgB4BGFXfiEHlYJdhBQrUr0zGoc3OxEBAQEBAQEBAREBAQsLCQkhL4IxgkQECwF7AiYCXw0GAgEBiCwEnSaPYpE4gQGHHQiKD4JaBZhpgTGEVIpbhwqFYY90NIFWAQEIAgGCLmyKCAEBAQ X-IronPort-AV: E=Sophos;i="5.26,475,1459807200"; d="scan'208";a="181307197" Received: from mail.tu-berlin.de ([130.149.7.33]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2016 09:37:24 +0200 X-tubIT-Incoming-IP: 91.65.128.247 Received: from ip5b4180f7.dynamic.kabel-deutschland.de ([91.65.128.247] helo=[192.168.178.42]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-5) with esmtpsa [TLSv1.2:DHE-RSA-AES128-SHA:128] for id 1bD5O6-0004oT-9a; Wed, 15 Jun 2016 09:37:23 +0200 To: caml users From: =?UTF-8?Q?Christoph_H=c3=b6ger?= Organization: =?UTF-8?Q?Technische_Universit=c3=a4t_Berlin?= Message-ID: Date: Wed, 15 Jun 2016 09:37:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.6.15.73317 X-PMX-Spam: Gauge=IIIIIII, Probability=0%, Report='' Subject: [Caml-list] Odd type error reporting 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